|
Ispirer SQLWays Database Migration Software
Importing Data into MySQL
LOAD DATA INFILE Command
During the import stage SQLWays uses the LOAD DATA INFILE command to load data from text files into MySQL tables.
The command has the following syntax:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'[REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS [TERMINATED BY '\t'] [[OPTIONALLY] ENCLOSED BY ''] [ESCAPED BY '\\' ] ] [LINES [STARTING BY ''] [TERMINATED BY '\n'] ] [IGNORE number LINES] [(col_name,...)]There are several options used with the LOAD DATA INFILE command:
REPLACE
If the table already exists in MySQL, you can use this option when you want existing rows to be updated basing on primary or unique key information or added to the table if primary key is not matched.
IGNORE
If the table already exists in MySQL, you can use this option when you do not want to update existing rows, when primary or unique key values are equivalent to the existing in the table. The rows from the text file which do not match primary or unique key in the table are inserted.
Remarks:
IGNORE and REPLACE options works properly only if tables have primary or unique keys.
IGNORE number LINES
This option specifies the number of rows from the beginning of the text file to be skipped during the insertion into the table.