Bug #4085 Improve the "Load Data Infile" syntax by allowing it to skip data values
Submitted: 9 Jun 2004 22:57 Modified: 4 Aug 2005 23:03
Reporter: Mike MySQLAB Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version: OS:
Assigned to: CPU Architecture:Any

[9 Jun 2004 22:57] Mike MySQLAB
Description:
Often the data file being imported contains fields that should not be loaded into the table. I would like to see a column list with an empty column name to indicate a field in the data at this position should be skipped. This will allow us to pick and choose which columns to import.

Example:
Say the data file has the fields: "A","SKIP1","B","C","SKIP2","D"

Load Data InFile 'filename.txt' into table MyTable1
(ColA,,ColB,ColC,,ColD)

The missing column names ",," will omit loading the "Skip1" and "Skip2" values.

How to repeat:
n/a
[4 Aug 2005 23:03] Jim Winstead
LOAD DATA has been extended in MySQL 5 to support more flexible data loading like this, although with a different syntax than suggested.