Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2002
    Posts
    63

    Unanswered: 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 11:16.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    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
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •