Exporting to an External Database

WinSQL Professional exports data based on an SQL query. To create an export, you must select a query on the Query tab before beginning the export.

Note: Parameter queries cannot be used to export data.

Once you are satisfied with the SQL script, point to the Query menu, click Export, and then choose one of the following options:

The following table describes each of the export options available in the WinSQL Export Wizard window:

 

Export option

Description

Export to a local text file

Output will be sent to a text file, with formatting options selectable on the windows that follow.

Export to an external text file

You can customize the export format in the following steps. These format options include delimiters and headers. This option does not use ODBC to create the text file.

IMPORTANT: Synametrics recommends that you use this option if the data type of the columns in the table are either numeric, date time, or characters less than 512 in length.

To save data containing binary fields or long character fields consider creating an ODBC DSN for Text and let WinSQL treat your text file as a table.

Export to an existing table in current database

Use this option if the table already exists in the target database. If you are trying to export the data in the same database, consider using an SQL UPDATE statement rather than using the Export Wizard.

Export to a new table in current database

Use this option if the table does not exist in the target database. WinSQL Professional will create a CREATE TABLE statement, matching the data types as closely as possible. You can manipulate the generated script to add constraints or change the data types.

Notes:

·If you decide to export the data into a new table, WinSQL Professional generates the SQL statement for you.

·It is important that you not change the name of the target table in the script. If you need to change the name, click Back and replace the table name.

Export to an existing table in another database

 Use this option if the table already exists in the target database.

Export to a new table in another database

This is similar to exporting to a new table in current database, except you are exporting to a different database.

Matching the source and target fields

It is very important that the order of source and the target fields have a one-to-one correspondence, depicted as follows:

 

Use the arrow icons to move a target field up or down until it matches with the corresponding source field. If the fields don’t match, either the data will get exported to incorrect columns or the export process will fail. By double-clicking a row you can exclude a column from the data transfer.

Saving the export template

Once you are satisfied with all the options and settings, you can save the template file for future use. If you specify a file name that already exists, WinSQL Professional overwrites the file with the new format.