0

I am trying to import a .sql file that was created with mysql 4.0 into the latest version of mysql and have received a syntax error regarding the following code:

CREATE TABLE edgemap (
  senderid int(10) unsigned default NULL,
  recipientid int(10) unsigned default NULL,
  messageid int(10) unsigned default NULL,
  messagedt timestamp(14) NOT NULL,
  reciptype enum('bcc','cc','to') default NULL,
  subject varchar(255) default NULL,
  KEY senderid (senderid,recipientid),
  KEY messageid (messageid),
  KEY messagedt (messagedt),
  KEY senderid_2 (senderid),
  KEY recipientid (recipientid)
) ENGINE=MyISAM; 

The error message I receive is:

ERROR 1064 (42000) at line 255752: 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,
  reciptype enum('bcc','cc','to') default NULL,
  subject varchar' at line 5

Any help would be much appreciated!

2 Answers 2

2

timestamp has maximum precision of 6 (microseconds):

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html

So change it to

 messagedt timestamp NOT NULL,

or

 messagedt timestamp(6) NOT NULL,

http://sqlfiddle.com/#!9/221c13

Sign up to request clarification or add additional context in comments.

Comments

-1

enum may not default to allowing NULL values in mysql 5, try changing that line to:

reciptype enum('bcc','cc','to') NULL,

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.