homepage Welcome to WebmasterWorld Guest from 54.196.62.132
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
Timestamps with load data infile
amateur2005




msg:1580402
 10:23 am on Sep 22, 2005 (gmt 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

 

coopster




msg:1580403
 8:00 pm on Sep 22, 2005 (gmt 0)

Welcome to WebmasterWorld, amateur2005.

You can use the NULL value (\N).

[dev.mysql.com...]

amateur2005




msg:1580404
 7:24 am on Sep 23, 2005 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved