Bug #8165 Skip file columns in LOAD DATA staements
Submitted: 27 Jan 2005 15:24 Modified: 4 Aug 2005 22:10
Reporter: Hans-Henrik Stærfeldt Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:4.1.5-gamma-20041010-log OS:Other (IRIX64 genome 6.5 04070317 IP35)
Assigned to: CPU Architecture:Any

[27 Jan 2005 15:24] Hans-Henrik Stærfeldt
Description:
It would be really helpful, if you in LOAD DATA statements
could use NULL in the field list into which the file columns
should be loaded. NULL columns would then ignore the
respective column in the loaded file.

LOAD DATA LOCAL INFILE 'foo' INTO TABLE bar (a,NULL,b,NULL,c);

Would then load 
  column 1 into 'a' 
  column 3 into 'b'
  column 5 into 'c'
while columns 2 and 4 were ignored.

How to repeat:
LOAD DATA LOCAL INFILE 'foo' INTO TABLE bar ;

Suggested fix:
LOAD DATA LOCAL INFILE 'foo' INTO TABLE bar (a,NULL,b,NULL,c);
[4 Aug 2005 22:10] Jim Winstead
MySQL 5.0 has a flexible LOAD DATA statement that allows this functionality, although not with the suggested syntax.
[5 Aug 2005 9:46] Hans-Henrik Stærfeldt
Thank you for your mail about being able to use @dummy in the
field list for skipping columns in the input file. Thats great :D.