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 > Create Table Error (on Update?)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-22-06, 10:07
mythix mythix is offline
Registered User
 
Join Date: Jun 2002
Posts: 63
Create Table Error (on Update?)

Hi

I maintain a PHP MySQL opensource project and am currently betaing a new version. I ahve the follwoing code:

Code:
CREATE TABLE  `jos_wats_highlight` (
                      `watsid` int(11) NOT NULL default '0',
                      `ticketid` int(11) NOT NULL default '0',
                      `datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
                      PRIMARY KEY  (`watsid`,`ticketid`)
                    );
This works fine for me running MySQL 4.1.7 and 4.1.18 - but I have just had an error reported:

SQL Error DB function failed with error number 1064
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY K SQL=CREATE TABLE `jos_wats_highlight` ( `watsid` int(11) NOT NULL default '0', `ticketid` int(11) NOT NULL default '0', `datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, PRIMARY KEY (`watsid`,`ticketid`) );
SQL =
CREATE TABLE `jos_wats_highlight` (
`watsid` int(11) NOT NULL default '0',
`ticketid` int(11) NOT NULL default '0',
`datetime` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
PRIMARY KEY (`watsid`,`ticketid`)
);

Does anyone know what is causing this? They are using MySQL 4.0.24

Thanks!

Last edited by mythix; 05-22-06 at 10:16.
Reply With Quote
  #2 (permalink)  
Old 05-22-06, 10:19
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
most likely cause of error: that syntax is not supported prior to 4.1

but it isn't needed anyway, it merely describes the behaviour of the 1st timestamp column in any table
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 05-22-06, 13:14
mythix mythix is offline
Registered User
 
Join Date: Jun 2002
Posts: 63
Thanks, seems to have solved problems

glad to see your still here on the forums always giving helpful advice
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