Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Timestamps with load data infile

10:23 am on Sep 22, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 22, 2005
votes: 0

Hello all...

I'm a newbie to mysql.. have been trying to make my way through it.. I have a table "registered_tags" with 2 columns..

1. reg_tags Varchar(16)
2. time_reg Timestamp

I need to load the table with tags info (16 char string) and have the date and time of insertion of that tag info to be inserted into the time_reg column automatically when the tag info is inserted..

My text file looks like this for now (made in windows) (space between fields is tab and lines are ending with '\r\n' <---- windows does that)

0580000d76d112d9 now()
0580000d2c184c6a now()
0580000decb3cf9c now()
0580000d0897174b now()
0580000d2552fbd5 now()
0580000d70ee065b now()
0580000d0ad09ada now()

I'm using the following query:

load data infile 'expected.txt' into table registered_tags lines terminated by '\r\n'

All the timestamps are given the value of :

0000-00-00 00:00:00

and when the query executes the following error is displayed for each row:

Data truncated for column 'Timestamp_Registered' at row 1

Can someone pls guide me how to go about inserting timestamps automatically into the timestamp_registered column whenever a new row is added through a data file?

Your help is much appreciated.. Thank you

8:00 pm on Sept 22, 2005 (gmt 0)


WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
votes: 2

Welcome to WebmasterWorld, amateur2005.

You can use the NULL value (\N).


7:24 am on Sept 23, 2005 (gmt 0)

New User

10+ Year Member

joined:Sept 22, 2005
votes: 0

Thanks i got it sorted now... the format of the file was giving trouble..