Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2014
    Posts
    8

    Unanswered: Getting a Timestamp related SQL syntax error

    Hi,

    I'm trying to create a table that I've exported from phpMyadmin into another machine.
    The import srcipt created this create statement:

    CREATE TABLE IF NOT EXISTS `query_log` (
    `query` varchar(255) DEFAULT NULL,
    `time` timestamp(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6),
    `elapsed` float DEFAULT NULL,
    `results` int(11) DEFAULT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    I'm getting this error:
    #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 '(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), `el' at line 3

    Cant find the answers anywhere. Does someone know the fix to this? using version 3.3.9 has something been depricated that I don't know about , is there a workaround?

  2. #2
    Join Date
    Jan 2015
    Posts
    2
    Try following:

    CREATE TABLE IF NOT EXISTS `query_log` (
    `query` VARCHAR(255) NULL DEFAULT NULL ,
    `time` TIMESTAMP on update CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,
    `elapsed` FLOAT NULL DEFAULT NULL ,
    `results` INT(11) NULL DEFAULT NULL
    ) ENGINE = MyISAM CHARACTER SET utf8;

    Doesnt give an error on my side!
    I think the problem were the "6" in the current_timestamp-function... it doesnt require any parameters. Also data type "TIMESTAMP" doesnt need a length, its set automatically.

    Greetings,
    jansch

  3. #3
    Join Date
    Jan 2014
    Posts
    8
    Yes that did it. Many thanks Jansch

Posting Permissions

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