Skip to content
The latest version of DbVisualizer was released 2024-12-04DOWNLOAD HERE ->

Exporting to SQL

Compared to other formats, exporting to SQL has a lot more configurability. What follows is a brief explanation of each option.

Export Table Window Example

Table Export

Common Options

  • Max Rows - How many rows to export. -1 means all rows.

Common SQL Options

  • Generate CREATE - Generates CREATE statements. Do not enable this option if the objects already exists in the target database.
  • Generate DROP - If Generate CREATE is selected, also generates DROP statements first.
  • Use Qualifier - Uses the Qualifier in the next step as a prefix to the object name in all generated statements.
  • Qualifier - The qualifier to use to prefix objects. For example: SAKILA will result in INSERT INTO SAKILA.\<object>.
  • Delimiters - Object name delimiters to use in all statements. For example [] will result in [\<object>].
  • Statement Separator - The statement separator, which will be pasted at the end of each statement.
  • Group By - Generate all statements for one object at a time, or generate each statement for all objects together. This setting is only relevant when exporting more than one object. In that case, grouping by statement type will put all the statements together (DROP,DROP,CREATE..), whereas Object will cause the grouping by table (DROP CREATE INSERT, DROP...) instead.
  • Add Before - Custom SQL that will be added before the generated SQL.
  • Add After - Custom SQL that will be added after the generated SQL.
  • Split Larger Than Size - Split results larger than this (size [g|G|m|M|k|K]) into multiple files, or -1 to not split. Example: 4k means split the file if it exceeds 4 kibibytes (4096 bytes).
  • Generate Multi-Row INSERT statements - Instead of having one insert per row, combine all inserts into one big statement.
  • Type of Multi-Row INSERT statement - Different databases have different syntaxes for multi-row inserts. INSERT INTO ... VALUES (),(),() might not work for all target databases. Choose the type according to the target database.
  • Generate MERGE statements - Instead of generating INSERT statements, MERGE statements can be generated instead. This can be useful the target already has partial data.
  • Type of MERGE statement - Different databases have different syntaxes for MERGE statements. Choose the type according to the target database.
  • The column to use when matching rows - When using MERGE, a column needs to be matched against in order to know when a row is a duplicate or not. Choose the column(s) (usually the primary key(s)) which uniquely identifies each row.

Table SQL Options

These options are specific to exporting one or more tables.

  • Generate INSERT - If unchecked, does not generate any statements to create rows with data, i.e. INSERT (or MERGE) statements.
  • Include Auto-Generated values - Include Auto-Generated values (AUTO_INCREMENT, and GENERATED ALWAYS or BY DEFAULT) in the INSERT statement.
  • Generate CREATE INDEX - Generate CREATE INDEX statements for existing indexes for the selected tables.

Schema Export

When exporting a schema, additional options are available.

Export Schema Options

View SQL Options

  • Generate INSERT - If unchecked, does not generate any statements to create rows for the selected views.

Code Object SQL Options

  • SQL Block Begin - The delimiter to use before the start of an SQL Block, e.g., CREATE PROCEDURE
  • SQL Block End - The delimiter to use after the end of an SQL Block, e.g., CREATE PROCEDURE