If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Multiple timestamps

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-03-06, 15:51
Eiolon Eiolon is offline
Registered User
 
Join Date: Jan 2006
Posts: 26
Multiple timestamps

I am using MySQL 5.0.22 and am trying to make multiple timestamps. One for when the record is inserted and one for when the record is updated.

Here is my structure:

Code:
create table requests (
id int not null primary key auto_increment,
employee varchar(50) not null,
category varchar(50) not null,
priority varchar(10) not null,
description text not null,
status varchar(10) not null default 'Open',
submitted timestamp not null default current_timestamp,
completed timestamp not null default current_timestamp,
technician varchar(50) not null
);
Here is the error:

Quote:
ERROR 1293 (HY000): Incorrect table definition; there can be only one TIMESTAMP
column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
Is there any way to accomplish this? I tried reading the reference manual on this and I thought I was doing it right but I guess not. Thanks!
Reply With Quote
  #2 (permalink)  
Old 08-03-06, 16:23
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
put the timestamp for updated first, and give it the ON UPDATE clause

put the timestamp for inserted second, and populate it manually
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On