MySQL - Multiple set on LOAD DATA INFILE

前端 未结 5 499
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 03:30

I\'ve a table_name like this:

No | Name | Inserted_Date | Inserted_By
=====================================

and then I\'ve

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-01 04:17

    There is no way to do that using the load data command in mysql. The data has to be in your input file.

    If you are on Linux, it would be easy enough to add the additional field data to your input file using sed or similar tools.

    Another alternative would be to upload your file and then run a query to update the missing fields with the data you desire.

    You could also set up a trigger on the table to populate those fields when an insert happens, assuming you want to use the mysql username value.

提交回复
热议问题