我正在尝试导入执行此查询的数据库中的表:
CREATE TABLE /*!32312 IF NOT EXISTS*/ "to_import" (
"id" int(11) unsigned NOT NULL auto_increment,
"reference" int(11) unsigned NOT NULL,
"trackid" int(11) unsigned NOT NULL,
"side_pos1" char(2) character set latin1 NOT NULL,
"side1" varchar(255) character set latin1 NOT NULL,
"pos1" char(2) character set latin1 NOT NULL,
"hh1" char(2) character set latin1 NOT NULL,
"mm1" char(2) character set latin1 NOT NULL,
"ss1" char(2) character set latin1 NOT NULL,
"atl1" varchar(255) character set latin1 NOT NULL,
"side_pos2" char(2) character set latin1 NOT NULL,
"side2" varchar(255) character set latin1 NOT NULL,
"pos2" char(2) character set latin1 NOT NULL,
"hh2" char(2) character set latin1 NOT NULL,
"mm2" char(2) character set latin1 NOT NULL,
"ss2" char(2) character set latin1 NOT NULL,
"atl2" varchar(255) character set latin1 NOT NULL,
"date" datetime NOT NULL,
PRIMARY KEY ("id")
) AUTO_INCREMENT=1311;
#
# Dumping data for table 'to_import'
#
LOCK TABLES "to_import" WRITE;
/*!40000 ALTER TABLE "to_import" DISABLE KEYS;*/
REPLACE INTO "to_import" ("id", "reference", "trackid", "side_pos1", "side1", "pos1", "hh1", "mm1", "ss1", "atl1", "side_pos2", "side2", "pos2", "hh2", "mm2", "ss2", "atl2", "date") VALUES
('1','0','550','0','Single Side','0','??','??','??','Noizefucker - Tons Of Bluesteel - Special Forces','0','Single Side','0','??','??','??','Noizefucker - Tons Of Bluesteel - Special Forces','2010-06-24 18:54:59');
... another replacement, like other 1200 line
REPLACE INTO "to_import" ("id", "reference", "trackid", "side_pos1", "side1", "pos1", "hh1", "mm1", "ss1", "atl1", "side_pos2", "side2", "pos2", "hh2", "mm2", "ss2", "atl2", "date") VALUES
('1310','0','463','#','','20','00','41','00','Ingler - Trek','#','','20','00','41','00','Ingler - Trek','2011-04-02 00:30:02');
/*!40000 ALTER TABLE "to_import" ENABLE KEYS;*/
UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE;*/
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;*/
但是我收到了这个错误:
#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 '"to_import" (
"id" int(11) unsigned NOT NULL auto_increment,
"reference" i' at line 1
这是什么意思?尝试在localhost上运行完美...
答案 0 :(得分:3)
删除双引号。要么不引用表和列,要么使用反引号(`)。
答案 1 :(得分:1)
这是您有效的sql文件:
CREATE TABLE `to_import` (
`id` int(11) unsigned NOT NULL auto_increment,
`reference` int(11) unsigned NOT NULL,
`trackid` int(11) unsigned NOT NULL,
`side_pos1` char(2) character set latin1 NOT NULL,
`side1` varchar(255) character set latin1 NOT NULL,
`pos1` char(2) character set latin1 NOT NULL,
`hh1` char(2) character set latin1 NOT NULL,
`mm1` char(2) character set latin1 NOT NULL,
`ss1` char(2) character set latin1 NOT NULL,
`atl1` varchar(255) character set latin1 NOT NULL,
`side_pos2` char(2) character set latin1 NOT NULL,
`side2` varchar(255) character set latin1 NOT NULL,
`pos2` char(2) character set latin1 NOT NULL,
`hh2` char(2) character set latin1 NOT NULL,
`mm2` char(2) character set latin1 NOT NULL,
`ss2` char(2) character set latin1 NOT NULL,
`atl2` varchar(255) character set latin1 NOT NULL,
`date` datetime NOT NULL,
PRIMARY KEY (`id`)
) AUTO_INCREMENT=1311;
#
# Dumping data for table 'to_import'
#
LOCK TABLES `to_import` WRITE;
/*!40000 ALTER TABLE `to_import` DISABLE KEYS;*/
REPLACE INTO `to_import` (`id`, `reference`, `trackid`, `side_pos1`, `side1`, `pos1`, `hh1`, `mm1`, `ss1`, `atl1`, `side_pos2`, `side2`, `pos2`, `hh2`, `mm2`, `ss2`, `atl2`, `date`) VALUES
('1','0','550','0','Single Side','0','??','??','??','Noizefucker - Tons Of Bluesteel - Special Forces','0','Single Side','0','??','??','??','Noizefucker - Tons Of Bluesteel - Special Forces','2010-06-24 18:54:59');
答案 2 :(得分:0)
字段名称用反引号分隔,而不是双引号。
CREATE TABLE /*!32312 IF NOT EXISTS*/ `to_import` (
`id` int(11) unsigned NOT NULL auto_increment,
`reference` int(11) unsigned NOT NULL,
等