470,849 Members | 1,014 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

Order of the columns (timestamp) in create statement makes a difference

The first timestamp will always be "automatically generated time." So if
the record is updated, or inserted, this time gets changed. However, if the
column order is changed with an alter statement, this is no longer the case.

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

Note above Update and timeEnter, although both are defined as timestamp,
operate differently.
Reference (See TIP 3):
http://unc.dl.sourceforge.net/source...ADME_mysql.txt

I hope this helps...it threw me for a loop the first time.

If you have an interesting TIP can you send it to me or post it? I'll add
to the list to benefit everyone.

Regards,

Mike Chirico
Jul 20 '05 #1
1 1252

"Mike Chirico" <mc******@comcast.net> skrev i en meddelelse
news:JY********************@comcast.com...
The first timestamp will always be "automatically generated time." So if
the record is updated, or inserted, this time gets changed. However, if the column order is changed with an alter statement, this is no longer the case.
create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

Note above Update and timeEnter, although both are defined as timestamp,
operate differently.


To avoid confusion, only use one timestamp, make the rest datetime

Leif
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by phil campaigne | last post: by
29 posts views Thread by pb648174 | last post: by
reply views Thread by Frank Swarbrick | last post: by
5 posts views Thread by Henry J. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.