Database Import Data Tool
The Database Import Tool allows users to import data from delmited files, Excel spreadsheets, fixed width files, or files of SQL insert statements into database tables.
The first step in the import tool is selecting the type of import (xls, delimited file, etc.) and the database table to import the data into. If launching the import tool from the database browser, the database table and schema information will be pre-selected.
Once the type and table are selected, the next screen differs based on the type of import. For SQL insert statement files, there is little more information to enter. For delimited files, RazorSQL needs to collect more information before the import can run. Listed below are some of the settings required by the import tool.
Import Options
Normal Mode: Select this option if the data being imported does not
contain line breaks. This option causes the Import Tool to look at the delimited
file line by line and then break each line up based on the delimiter.
Advanced Mode: Use this option if there are line breaks contained in
the data to import. If there are line breaks in the data, the entire data cell
should be wrapped in double qutoes.
Delimiter: Select or enter the delimiter used to separate values in the file.
Delimited File: Select the file that contains the delimited data to import.
Delimited File Start Row: If using the line by line import option, tell the
Import Tool which line to start with by using this option.
Delimited File End Row: If using the line by line import option, tell
the Import Tool which line to end with by using this option.
Escape Single Quotes: Select this option to escape any single quotes
located in the data. Select this option if the data contains single quotes and they
are not escaped.
Escape Character: The escape character to use if escaping single quotes.
Column Options
Populate Column: If using the line by line option, this option
gives the user the ability to select which columns correspond to the data
in the delimited file.
Delimited File Column Number: If using the line by line option,
this option gives the user the ability to tell the Import Tool which column of
the delimited file corresponds to the column of the table.
Wrap in Single Quotes: This option allows the user to specify
whether or not to wrap the column data in single quotes when generating
the SQL to import. If textual data is already wrapped in single quotes,
deselect this option.
The Excel and Fixed Width file import options have the same options that are listed above.
Once the above options are entered, the final screen offers some more settings. Listed below is some documenation on these.
Generate SQL Output File: The import tool will generate SQL insert
statements based on the data in the import file and write those SQL statements to the
specified output file. This is useful if you would like to run the import at a later
time, or to just preview the entire import.
Halt On Error: If this option is checked, if an error occurs, RazorSQL
will stop execution of the import. If not selected, RazorSQL will continue to import
data from the import file until there is not more data to import.
Execute As Batch: If this option is selected, RazorSQL will batch up
groupings of data inserts into one call. This can be useful if you have slow or latent
network connection to the database. There is an option for how many statements to
bundle up per call. The higher the statement count, the fewer the network calls. If there
is an error that occurs while doing the import in this mode, it is harder to determine
exactly where the error occurred as it could be any one of the statements in the batch. If
you are concerned about errors, it may be wiser to use the Execute One Statement at a Time option.
Execute One Statement at a Time: This option generates the SQL necessary
to insert data into the database for each row in the import file. It sends these statements
one at a time to the database. If a statement fails, RazorSQL generates an output log
detailing exactly which statement at which row number failed. This option may be slower
than the Execute As Batch option since more network calls are required.
Save to File Only: If this option is selected, RazorSQL will not
execute the SQL inserts generated by the import tool. It will simply save those
SQL insert statements to an output file.