Table of ContentsPreviousNext

Ispirer
Please, note, that Ispirer SQLWays 6.0 is no longer supported and provided to clients.
You can try out automated conversion of databases and applications with Ispirer Toolkit for free. Download free trial.
Check out the relevant toolkit documentation.


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.


Table of ContentsPreviousNext
Copyright 1999-2023 Ispirer Systems.
Ispirer and SQLWays are registered trademarks. All other product names may be trademarks of the respective companies.
All rights reserved.