Abhishek Ranjan
Abhishek Ranjan

Reputation: 497

What is the issue with this sql CREATE TABLE command?

I'm trying to move a schema from mysql5.6 to mysql5.5.

I exported the schema from v5.6 to a .sql file, and when trying to import the file to v5.5, I'm getting an error, but I do not know what the error is since sql reports all errors as error in sql syntax.
Here is my create command, I hope someone can help figure out what is going wrong ? The error is in this create command only, hence posting only the relevant part here

DROP TABLE IF EXISTS `status_change_logs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `status_change_logs` (
  `entry_id` int(11) NOT NULL AUTO_INCREMENT,
  `match_id` int(11) NOT NULL,
  `status` smallint(4) NOT NULL,
  `timestamp` datetime(4) NOT NULL,
  PRIMARY KEY (`entry_id`),
  KEY `match_id` (`match_id`)
) ENGINE=InnoDB AUTO_INCREMENT=102273 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

Error

ERROR 1064 (42000) at line 897: 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 '(4) NOT NULL,
  PRIMARY KEY (`entry_id`),
  KEY `match_id` (`match_id`)
) ENGINE' at line 5

Operation failed with exitcode 1

Upvotes: 0

Views: 82

Answers (1)

px1mp
px1mp

Reputation: 5372

I believe that datetime type doesn't take the size in parentheses i.e. it should be

`timestamp` datetime NOT NULL,

instead of

`timestamp` datetime(4) NOT NULL,

surely at least for older versions of MySQL.

Upvotes: 1

Related Questions