これを行うには、最初にユーザー変数を設定し、SET句でこの変数をインクリメントします。つまり
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