RazorSQL How to Import Data
The first step before importing data is to get connected to a database. For more information on getting connected, see How to Get Connected.
Once connected to a database, users can import data by selecting the DB Tools -> Import option, selecting the import data option from the right-click menu of the database browser, or by selecting the import data toolbar icon.
Once the import tool is displayed, users will need to determine what kind of data they want to import, and the database or schema and table they want to import data into.
File of SQL statements - select this option to import from a file containing SQL insert statements. Select the type of SQL statement separator that was used to separate the SQL statements in the file. RazorSQL will then parse the file based on the statement separator and execute the SQL statements to import the data.
Delimited Files - select this import type if the data you wish to import is in a delmited format such as comma-delimited (csv), tab-delimited, etc.
Excel Spreadsheets - select this import type if the data you wish to import is contained in Excel (97-2003) format. RazorSQL does not support importing from .xlsx files at this point.
Fixed Width Files - select this option to import data from fixed width files.
Once the import type and database / schema and table are selected, the next screen has options to tell to tell RazorSQL more about the import. For example, if a delimited file, RazorSQL needs to know what type of delimiter it is, and also the location of the file. Also, RazorSQL needs to know which line of the file to use to start parsing the contents (the default is line 1, but if the first line contains column names, you would want to start on line 2). Other options are which columns to populate (the default is all of them), what order the columns are in, etc.
The final screen has more options for how to do the import.
Generate SQL Output File - Select this option if you would like RazorSQL to generate
an output file of all of the generated SQL insert statements used to import the data.
Halt on Error - Select this option if you would like RazorSQL to stop the import if an error occurs. If not selected, RazorSQL will continue reading the import file and importing data. If selected, once an error is found, no more data will attempted to be inserted. If there is an error, RazorSQL will give the user information on which line the error occurred. If using the batch option, RazorSQL will tell the user on which range of lines the error occurred.
Execute as Batch - Use this option to reduce the number of network calls to the database during import. RazorSQL will use the value of the "Number of Statements per Call" field to determine how many statements to send to the database at a time. If using this option, and an error occurs, it will be more difficult to pinpoint exactly where the error occurred.
Execute One Statement at a Time - Use this option to make a network call for each record being imported. This option may be slower depending on the network connection, but if an error occurs, RazorSQL will be able to determine exactly which line caused the error.
Save to File Only - Use this option to only save the generated SQL insert statements to a file, but not actually execute them against the database. With this option, no data is imported, but the SQL insert statements necessary to import the data are saved to a file.