Du kan göra det genom att först ställa in en användarvariabel och öka denna variabel i din SET-sats, dvs.
SET @a:=0; -- initialize the line count
LOAD DATA INFILE 'c:/tools/import.csv' -- my test import
REPLACE
INTO TABLE tableName
FIELDS TERMINATED BY ',' ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES # first row is column headers
(fieldA,fieldB,fieldC)
SET import_date = now(),
import_file = 'import.csv',
import_line = @a:[email protected]+1; -- save the incremented line count