How can i add date as auto update when import data from csv file?

前端 未结 2 587
挽巷
挽巷 2021-01-28 13:40

I want to add date and time auto update. Can anyone help me how can i do this. i am importing data from csv file and there is no any field of date i want to auto update this fie

2条回答
  •  醉话见心
    2021-01-28 13:58

    Just add a NOW() for that field.

    Or if you have two seperate columns for date and time then you can use the build-in functions CURDATE() and TIME().

    Example:

    LOAD DATA INFILE 'data.csv'
    INTO TABLE t1
    (column1, col2, col3)
    FIELDS TERMINATED BY ';'
    LINES TERMINATED BY '\n'
    SET date_time_field = NOW();
    

提交回复
热议问题