表导入/导出后的SQL错误

时间:2016-05-09 06:46:27

标签: mysql opencart

嘿我正在尝试将产品表从一个opencart商店导出到另一个,但我遇到了一些问题。 大多数表都有0个导入/导出问题,但是product表会出现以下错误。

  

1064 - 您的SQL语法出错;检查与您的MariaDB服务器版本对应的手册,以便在第37行

附近使用正确的语法

这是代码本身。

    CREATE TABLE `product` (
  `product_id` int(11) NOT NULL,
  `model` varchar(64) NOT NULL,
  `sku` varchar(64) NOT NULL,
  `upc` varchar(12) NOT NULL,
  `ean` varchar(14) NOT NULL,
  `jan` varchar(13) NOT NULL,
  `isbn` varchar(13) NOT NULL,
  `mpn` varchar(64) NOT NULL,
  `location` varchar(128) NOT NULL,
  `quantity` int(4) NOT NULL,
  `stock_status_id` int(11) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `manufacturer_id` int(11) NOT NULL,
  `shipping` tinyint(1) NOT NULL DEFAULT '1',
  `price` decimal(15,4) NOT NULL DEFAULT '0.0000',
  `points` int(8) NOT NULL,
  `tax_class_id` int(11) NOT NULL,
  `date_available` date NOT NULL,
  `weight` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `weight_class_id` int(11) NOT NULL,
  `length` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `width` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `height` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `length_class_id` int(11) NOT NULL,
  `subtract` tinyint(1) NOT NULL DEFAULT '1',
  `minimum` int(11) NOT NULL DEFAULT '1',
  `sort_order` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL,
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `viewed` int(5) NOT NULL,
  `measurement_class_id` int(11) NOT NULL DEFAULT '0',
  `maximum` int(11) NOT NULL DEFAULT '0',
  `cost` decimal(15,4) NOT NULL DEFAULT '0.0000',
  `style` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '0'COMMENT
) ;

2 个答案:

答案 0 :(得分:0)

删除最后一行的评论:

   CREATE TABLE `product` (
  `product_id` int(11) NOT NULL,
  `model` varchar(64) NOT NULL,
  `sku` varchar(64) NOT NULL,
  `upc` varchar(12) NOT NULL,
  `ean` varchar(14) NOT NULL,
  `jan` varchar(13) NOT NULL,
  `isbn` varchar(13) NOT NULL,
  `mpn` varchar(64) NOT NULL,
  `location` varchar(128) NOT NULL,
  `quantity` int(4) NOT NULL,
  `stock_status_id` int(11) NOT NULL,
  `image` varchar(255) DEFAULT NULL,
  `manufacturer_id` int(11) NOT NULL,
  `shipping` tinyint(1) NOT NULL DEFAULT '1',
  `price` decimal(15,4) NOT NULL DEFAULT '0.0000',
  `points` int(8) NOT NULL,
  `tax_class_id` int(11) NOT NULL,
  `date_available` date NOT NULL,
  `weight` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `weight_class_id` int(11) NOT NULL,
  `length` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `width` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `height` decimal(15,8) NOT NULL DEFAULT '0.00000000',
  `length_class_id` int(11) NOT NULL,
  `subtract` tinyint(1) NOT NULL DEFAULT '1',
  `minimum` int(11) NOT NULL DEFAULT '1',
  `sort_order` int(11) NOT NULL,
  `status` tinyint(1) NOT NULL,
  `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `viewed` int(5) NOT NULL,
  `measurement_class_id` int(11) NOT NULL DEFAULT '0',
  `maximum` int(11) NOT NULL DEFAULT '0',
  `cost` decimal(15,4) NOT NULL DEFAULT '0.0000',
  `style` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '0'
) ;

<强>样品

MariaDB []> CREATE TABLE `product` (   `product_id` int(11) NOT NULL,   `model` varchar(64) NOT NULL,   `sku` varchar(64) NOT NULL,   `upc` varchar(12) NOT NULL,   `ean` varchar(14) NOT NULL,   `jan` varchar(13) NOT NULL,   `isbn` varchar(13) NOT NULL,   `mpn` varchar(64) NOT NULL,   `location` varchar(128) NOT NULL,   `quantity` int(4) NOT NULL,   `stock_status_id` int(11) NOT NULL,   `image` varchar(255) DEFAULT NULL,   `manufacturer_id` int(11) NOT NULL,   `shipping` tinyint(1) NOT NULL DEFAULT '1',   `price` decimal(15,4) NOT NULL DEFAULT '0.0000',   `points` int(8) NOT NULL,   `tax_class_id` int(11) NOT NULL,   `date_available` date NOT NULL,   `weight` decimal(15,8) NOT NULL DEFAULT '0.00000000',   `weight_class_id` int(11) NOT NULL,   `length` decimal(15,8) NOT NULL DEFAULT '0.00000000',   `width` decimal(15,8) NOT NULL DEFAULT '0.00000000',   `height` decimal(15,8) NOT NULL DEFAULT '0.00000000',   `length_class_id` int(11) NOT NULL,   `subtract` tinyint(1) NOT NULL DEFAULT '1',   `minimum` int(11) NOT NULL DEFAULT '1',   `sort_order` int(11) NOT NULL,   `status` tinyint(1) NOT NULL,   `date_added` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',   `date_modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',   `viewed` int(5) NOT NULL,   `measurement_class_id` int(11) NOT NULL DEFAULT '0',   `maximum` int(11) NOT NULL DEFAULT '0',   `cost` decimal(15,4) NOT NULL DEFAULT '0.0000',   `style` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '0' );
Query OK, 0 rows affected (0.32 sec)

MariaDB []> select version();
+---------------------+
| version()           |
+---------------------+
| 10.1.10-MariaDB-log |
+---------------------+
1 row in set (0.00 sec)

MariaDB []>

答案 1 :(得分:0)

您好错误,因为您尚未完成&#34;样式&#34;的最后一行注释代码列执行以下选项之一:

a)添加评论说明

`style` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '0' COMMENT "comment description"

b)删除评论说明

`style` varchar(15) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '0'