Jump to content

keep getting error when trying to upload to mysql Error SQL query


fastz28

Recommended Posts

Error

SQL query:

#

# Table structure for table `message`

#

CREATE TABLE `message` (

`messageid` int( 11 ) NOT NULL AUTO_INCREMENT ,

`isread` char( 1 ) NOT NULL default '0',

`lockstatus` char( 1 ) NOT NULL default '0',

`message` longtext,

`sender` varchar( 50 ) NOT NULL default '',

`recipient` varchar( 50 ) NOT NULL default '',

`date` timestamp( 14 ) NOT NULL ,

PRIMARY KEY ( `messageid` ) ,

KEY `sender` ( `sender` ) ,

KEY `recipient` ( `recipient` ) ,

KEY `readstatus` ( `recipient` , `isread` )

) ENGINE = MYISAM AUTO_INCREMENT =5;

 

MySQL said: b_help.png

#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 '(14) NOT NULL,

  PRIMARY KEY  (`messageid`),

  KEY `sender` (`sender`),

  KEY' at line 12

Link to comment
Share on other sites

try replacing:

`date` timestamp( 14 ) NOT NULL

with 

`date` timestamp NOT NULL

or try 

`date` timestamp AS 'MM/DD/YYYY' NOT NULL

(put in whatever you want... im not playing with SQL atm, but try those...)

Edited by codelinx
Link to comment
Share on other sites

Look here as well...

http://dev.mysql.com/doc/refman/5.7/en/timestamp-initialization.html

 

 

From:

http://dev.mysql.com/doc/refman/5.7/en/date-and-time-literals.html

 

"String and Numeric Literals in Date and Time Context.

...

As a string in either 'YYYY-MM-DD HH:MM:SS' or 'YY-MM-DD HH:MM:SS' format. A relaxed syntax is permitted here, too: Any punctuation character may be used as the delimiter between date parts or time parts. For example,'2012-12-31 11:30:45''2012^12^31 11+30+45''2012/12/31 11*30*45', and '2012@12@31 11^30^45' are equivalent."

Edited by codelinx
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.