MySQL Forums
Forum List  »  InnoDB

Re: Self-updating timestamp?
Posted by: Ted Roche
Date: January 20, 2005 02:52PM

Heikki Tuuri wrote:

> the FIRST column declared to have the type
> TIMESTAMP in a table is the automatically updating
> one. You do not specify any default value, the
> type TIMESTAMP itself means it is automatically
> updating.

Further, if I create a table with the definition:


CREATE TABLE CHType
(
iCHTypePK BIGINT(20) NOT NULL AUTO_INCREMENT,
cCreditHourTypeName CHAR(30) NULL,
iUserFK BIGINT(20) NULL,
tChanged TIMESTAMP(14) NULL,
PRIMARY KEY (iCHTypePK)
)
TYPE= InnoDB
;

Executing INSERT commands leave the TIMESTAMP field untouched:

mysql> insert into CHType (cCreditHourTypeName, iUserFK) values ("Credit Hour", 1);
Query OK, 1 row affected (0.01 sec)

mysql> insert into CHType (cCreditHourTypeName, iUserFK) values ("Life", 1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into CHType (cCreditHourTypeName, iUserFK) values ("Property/Casualty", 1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into CHType (cCreditHourTypeName, iUserFK) values ("Annuity", 1);
Query OK, 1 row affected (0.00 sec)

mysql> insert into CHType (cCreditHourTypeName, iUserFK) values ("Ethics", 1);
Query OK, 1 row affected (0.00 sec)

mysql> select * from CHType;
+-----------+---------------------+---------+----------+
| iCHTypePK | cCreditHourTypeName | iUserFK | tChanged |
+-----------+---------------------+---------+----------+
| 1 | Credit Hour | 1 | NULL |
| 2 | Life | 1 | NULL |
| 3 | Property/Casualty | 1 | NULL |
| 4 | Annuity | 1 | NULL |
| 5 | Ethics | 1 | NULL |
+-----------+---------------------+---------+----------+
5 rows in set (0.00 sec)

Ted Roche, MCSE, MCSD
Ted Roche & Associates, LLC
http://www.tedroche.com

Options: ReplyQuote


Subject
Views
Written By
Posted
7814
January 18, 2005 04:44PM
3480
January 19, 2005 08:51AM
3223
January 19, 2005 02:47PM
3084
January 20, 2005 01:37PM
Re: Self-updating timestamp?
3236
January 20, 2005 02:52PM
3263
January 20, 2005 07:46PM
3019
January 21, 2005 08:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.