Return to Snippet

Revision: 9334
at October 30, 2008 15:12 by RICHARDP


Initial Code
> LOAD DATA LOCAL INFILE '/tmp/testdata.txt' INTO TABLE testtable FIELDS TERMINATED BY '\t';

> LOAD DATA LOCAL INFILE '/tmp/VICIDB/matltran.txt' INTO TABLE matltran FIELDS TERMINATED BY '\t' FIELDS OPTIONALLY ENCLOSED BY '"';

Initial URL

                                

Initial Description
Fields are tab delimited and need to match table schema. 
I've found the tab separator  ASCII(009)  preferable over using a comma.

The second version can help remove double quotation marks around character fields. 

Don't forget the keyword LOCAL.

Initial Title
Import data from tab - delimited datafile to SQL table.

Initial Tags
sql, table, data, load

Initial Language
SQL