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 field in database when each data inserted through csv file. please help
Asked
Active
Viewed 880 times
0
-
Hello and welcome to stackoverflow. Perhaps you should take some time to review your question in order to explain more clearly your problem and how you have tried to solve it until now. Once done, while waiting for answers you could take a look at http://stackoverflow.com/help/someone-answers to know what you should do when someone answer to your question. – Sylvain Leroux Aug 06 '13 at 13:44
2 Answers
1
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();

juergen d
- 201,996
- 37
- 293
- 362
-
how can i add NOW() after creating table? I didnt find any option for that in phpMyadmi – Sanjay Rathod Aug 06 '13 at 12:43
-