PHP MySQL:加载数据infile在主键上添加行索引

时间:2017-09-14 04:26:50

标签: php mysql load-data-infile

我使用加载数据infile上传CSV文件,如何将行索引设置为特定列。

$max_asset_id = 79;

LOAD DATA LOCAL INFILE '$file'
IGNORE INTO TABLE asset_mgt.asset_info
FIELDS TERMINATED BY ','
ENCLOSED BY '\"' 
LINES TERMINATED BY '\n'
(@asset_id, @type_of_asset, @asset_description, @model, @serial_number, @asset_tagging_no, @quanity, @remarks)
SET asset_id = /*Add increment here $max_asset_id++ */,
type_of_asset = @type_of_asset,
asset_description = @asset_description,
model = @model,
serial_number = @serial_number,
asset_tagging_no = @asset_tagging_no,
quanity = @quanity,
remarks = @remarks

0 个答案:

没有答案