Rubem Cerqueira
Rubem Cerqueira

Reputation: 11

ERROR 1064 (42000) SQL syntax

I am having trouble importing a schema in mysql.

mysql -u user -p print < jasmine.sql 

ERROR 1064 (42000) at line 23: 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,
job_id tinytext NOT NULL,
printer tinytext NOT NULL,
`u' at line 3

Here is my code:

CREATE TABLE `jobs_log` (
  `id` mediumint(9) NOT NULL auto_increment, 
  `date` timestamp(14) NOT NULL,
  `job_id` tinytext NOT NULL, 
  `printer` tinytext NOT NULL,
  `user` tinytext NOT NULL, 
  `server` tinytext NOT NULL, 
  `title` tinytext NOT NULL,
  `copies` smallint(6) NOT NULL default '0', 
  `pages` smallint(6) NOT NULL default '0', 
  `options` tinytext NOT NULL, 
  `doc` tinytext NOT NULL, 
  PRIMARY KEY  (`id`) 
) TYPE=MyISAM COMMENT='Lists all the jobs successfully sent for printing';

I am using Mysql-Server Version 5.5.

Upvotes: 1

Views: 5662

Answers (4)

Arun Kumar M
Arun Kumar M

Reputation: 848

timestamp doesnt have length property!

When upgrading to MySQL 5.5 or later, you must convert TYPE to use ENGINE instead.

Try this:

CREATE TABLE jobs_log (
id mediumint(9) NOT NULL auto_increment,
date timestamp,
job_id tinytext NOT NULL,
printer tinytext NOT NULL,
user tinytext NOT NULL,
server tinytext NOT NULL,
title tinytext NOT NULL,
copies smallint(6) NOT NULL default '0',
pages smallint(6) NOT NULL default '0',
options tinytext NOT NULL,
doc tinytext NOT NULL,
PRIMARY KEY (id)
)ENGINE = MyIsam COMMENT='Lists all the jobs successfully sent for printing';

Upvotes: 0

stackoverflow
stackoverflow

Reputation: 78

Timestamp doesnt have length property, so replace the timestamp(14) with timestamp(). MyISAM is an engine, so replace the TYPE with ENGINE.

Upvotes: -1

Gordon Linoff
Gordon Linoff

Reputation: 1271111

I think the error is pretty clear. Timestamp does not take a length parameter. Use:

date timestamp NOT NULL, 

However, if this is just a date, then use date:

`date` date NOT NULL;

EDIT:

And then change TYPE to ENGINE (thanks to Arun).

Upvotes: 0

nidhoeggr09
nidhoeggr09

Reputation: 153

Just use timestamp instead of timestamp(14). As far as i know, there is a timestamp(N) deprecation.

Upvotes: 3

Related Questions