![]() |
Home My Faqts Contributors About Help |
| Entry | Add Entry Alert - Edit this Entry |
Jun 23rd, 2004 23:56
Mike Chirico
http://sourceforge.net/project/showfiles.php?group_id=79320&package;_id=115696
I have 2 TIMESTAMP fields, does the order make a difference? YES.
create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );
The first timestamp will always be the "automatically generated" time.
So if the record is updated, or inserted, this time gets changed. If
the order is changed, "timeEnter" is before "timeUpdate",
then, "timeEnter" would get updated. First timestamp column updates
automatically.
Note, in the table above timeEnter will only get updated if passed a
null value. But, timeUpdate doesn't need a NULL value.
insert into t (a,b,timeEnter) values (1,2,NULL);
See TIP 3 on the source URL above.
© 1999-2004 Synop Pty Ltd