导入数据时出现SQL错误#1064

时间:2015-03-27 17:11:11

标签: mysql

这是错误

SQL query:

UPDATE TABLE `tblclients` ( `id` int(10) NOT NULL AUTO_INCREMENT,   `firstname` text NOT NULL, `lastname` text NOT NULL, `companyname` text NOT NULL, `email` text NOT NULL, `address1` text NOT NULL, `address2` text NOT   NULL, `city` text NOT NULL, `state` text NOT NULL, `postcode` text NOT NULL,   `country` text NOT NULL, `phonenumber` text NOT NULL, `password` text NOT NULL, `currency` int(10) NOT NULL, `defaultgateway` text NOT NULL,   `credit` decimal(10,2) NOT NULL, `taxexempt` text NOT NULL, `latefeeoveride` text NOT NULL, `overideduenotices` text NOT NULL,   `separateinvoices` text NOT NULL, `disableautocc` text NOT NULL,   `datecreated` date NOT NULL, `notes` text NOT NULL, `billingcid` int(10) NOT   NULL, `securityqid` int(10) NOT NULL, `securityqans` text NOT NULL,   `groupid` int(10) NOT NULL, `cardtype` varchar(255) NOT NULL DEFAULT '',   `cardlastfour` text NOT NULL, `cardnum` blob NOT NULL, `startd[...]  

MySQL said: Documentation
#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 'TABLE `tblclients` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `firstname` tex' at line 1 

这是我要导入的表

 UPDATE TABLE `tblclients` (  
  `id` int(10) NOT NULL AUTO_INCREMENT,  
  `firstname` text NOT NULL,  
  `lastname` text NOT NULL,  
  `companyname` text NOT NULL,  
  `email` text NOT NULL,  
  `address1` text NOT NULL,  
  `address2` text NOT NULL,  
  `city` text NOT NULL,  
  `state` text NOT NULL,  
  `postcode` text NOT NULL,  
  `country` text NOT NULL,  
  `phonenumber` text NOT NULL,  
  `password` text NOT NULL,  
  `currency` int(10) NOT NULL,  
  `defaultgateway` text NOT NULL,  
  `credit` decimal(10,2) NOT NULL,  
  `taxexempt` text NOT NULL,  
  `latefeeoveride` text NOT NULL,  
  `overideduenotices` text NOT NULL,  
  `separateinvoices` text NOT NULL,  
  `disableautocc` text NOT NULL,  
  `datecreated` date NOT NULL,  
  `notes` text NOT NULL,  
  `billingcid` int(10) NOT NULL,  
  `securityqid` int(10) NOT NULL,  
  `securityqans` text NOT NULL,  
  `groupid` int(10) NOT NULL,  
  `cardtype` varchar(255) NOT NULL DEFAULT '',  
  `cardlastfour` text NOT NULL,  
  `cardnum` blob NOT NULL,  
  `startdate` blob NOT NULL,  
  `expdate` blob NOT NULL,  
  `issuenumber` blob NOT NULL,  
  `bankname` text NOT NULL,  
  `banktype` text NOT NULL,  
  `bankcode` blob NOT NULL,  
  `bankacct` blob NOT NULL,  
  `gatewayid` text NOT NULL,  
  `lastlogin` datetime DEFAULT NULL,  
  `ip` text NOT NULL,  
  `host` text NOT NULL,  
  `status` enum('Active','Inactive','Closed') NOT NULL DEFAULT 'Active',  
  `language` text NOT NULL,  
  `pwresetkey` text NOT NULL,  
  `pwresetexpiry` int(10) NOT NULL,  
  PRIMARY KEY (`id`),  
  KEY `firstname_lastname` (`firstname`(32),`lastname`(32)),  
  KEY `email` (`email`(64))  
) ENGINE=MyISAM AUTO_INCREMENT=916 DEFAULT CHARSET=latin1;  
;  

1 个答案:

答案 0 :(得分:0)

mySql中的更新语法是:

UPDATE [LOW_PRIORITY] [IGNORE] table_reference
    SET col_name1={expr1|DEFAULT} [, col_name2={expr2|DEFAULT}] ...
    [WHERE where_condition]
    [ORDER BY ...]
    [LIMIT row_count]

示例是

UPDATE Customers
SET ContactName='ashutosh', City='bangalore'
WHERE id=100;

您的陈述看起来像表创建语法。修复语法