What is the correct syntax to import a part of a file into a MySQL database? For instance, I want to only load lines 50 to line 1000.
Currently my SQL statement imports an entire file into the database.
LOAD DATA INFILE 'myFile.txt' INTO TABLE myTable (col1, col2) FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
I want to be more selective. Any suggestions? Thanks
LOAD DATA INFILE
only alows you to skip lines at the beginning of the file (by saying e.g. IGNORE 49 LINES
), but it will import all lines until the end of the file. See LOAD DATA INFILE
Syntax for details.