Reputation: 5
error message
#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 '() NOT NULL,
`content` varchar(255) NOT NULL,
`sent_by` varchar(30) NOT NULL' at line 4
sql
CREATE TABLE IF NOT EXISTS `chat` (
`id` INT( 10 ) NOT NULL ,
`member_id` VARCHAR( 30 ) NOT NULL ,
`time_sent` DATETIME( ) NOT NULL ,
`content` VARCHAR( 255 ) NOT NULL ,
`sent_by` VARCHAR( 30 ) NOT NULL ,
`seen` INT( 1 ) NOT NULL
) ENGINE = INNODB AUTO_INCREMENT =22 DEFAULT CHARSET = latin1;
what is the problem now? I just import into my server and happened this.. In my localhost is no problem when I import the sql
Upvotes: 0
Views: 2152
Reputation: 3833
syntax issue
- mysql doesnt know how to parse data_type of
datetime( )
. it only understands datetime or datetime(0-6) as valid data_type s
fix
change
`time_sent` DATETIME( ) NOT NULL ,
to
`time_sent` DATETIME NOT NULL ,
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
(create_definition,...)
[table_options]
[partition_options]
create_definition:
col_name column_definition
...
column_definition:
data_type [NOT NULL | NULL] [DEFAULT default_value]
...
data_type:
...
| DATETIME[(fsp)]
...
fsp stands for fractional seconds part and must be between 0-6
from data_type syntax definition, mysql understands either
DATETIME(fsp)
or
DATETIME
but not
DATETIME()
Upvotes: 1