gpt4 book ai didi

mysql - 一些帮助查找此 SQL 语句中的错误

转载 作者:行者123 更新时间:2023-11-29 08:35:45 25 4
gpt4 key购买 nike

任何人都可以帮我检查这个 sql 语句是否出现此错误:

Error

> SQL query:
>
> CREATE TABLE `dp_banks` (
> `id` int( 11 ) NOT NULL AUTO_INCREMENT ,
> `owner` int( 11 ) NOT NULL default '0',
> `bname` varchar( 128 ) NOT NULL default '',
> `baddress` varchar( 128 ) NOT NULL default '',
> `bcity` varchar( 64 ) NOT NULL default '',
> `bzip` varchar( 16 ) NOT NULL default '',
> `bcountry` char( 2 ) NOT NULL default '',
> `bstate` varchar( 32 ) NOT NULL default '',
> `bphone` varchar( 32 ) NOT NULL default '',
> `bnameacc` varchar( 128 ) NOT NULL default '',
> `baccount` varchar( 32 ) NOT NULL default '',
> `btype` char( 2 ) NOT NULL default '',
> `brtgnum` varchar( 9 ) NOT NULL default '',
> `bswift` varchar( 32 ) NOT NULL default '',
> `status` tinyint( 1 ) NOT NULL default '0',
> `default` tinyint( 1 ) NOT NULL default '0',
> PRIMARY KEY ( `id` )
> ) TYPE = MYISAM AUTO_INCREMENT =1;
>
> 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 'TYPE=MyISAM AUTO_INCREMENT=1' at line 19

主要代码如下:

-- 
-- Table structure for table `dp_banks`
--

DROP TABLE IF EXISTS `dp_banks`;
CREATE TABLE `dp_banks` (
`id` int(11) NOT NULL auto_increment,
`owner` int(11) NOT NULL default '0',
`bname` varchar(128) NOT NULL default '',
`baddress` varchar(128) NOT NULL default '',
`bcity` varchar(64) NOT NULL default '',
`bzip` varchar(16) NOT NULL default '',
`bcountry` char(2) NOT NULL default '',
`bstate` varchar(32) NOT NULL default '',
`bphone` varchar(32) NOT NULL default '',
`bnameacc` varchar(128) NOT NULL default '',
`baccount` varchar(32) NOT NULL default '',
`btype` char(2) NOT NULL default '',
`brtgnum` varchar(9) NOT NULL default '',
`bswift` varchar(32) NOT NULL default '',
`status` tinyint(1) NOT NULL default '0',
`default` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

如果有任何快速帮助,我将不胜感激。我已经尝试了所有可能的方法来调试它,但都无济于事。

谢谢

最佳答案

TYPE 表选项在 MySQL 4.0 中已弃用。您应该使用 ENGINE 选项:

ENGINE = MyISAM

来自MySQL docs :

The older TYPE option was synonymous with ENGINE. TYPE has been deprecated since MySQL 4.0 but is still supported for backward compatibility in MySQL 5.1 (excepting MySQL 5.1.7). Since MySQL 5.1.8, it produces a warning. It is removed in MySQL 5.5. You should not use TYPE in any new applications, and you should immediately begin conversion of existing applications to use ENGINE instead.

来源: http://dev.mysql.com/doc/refman/5.1/en/create-table.html

我猜两个突出显示的句子之一解释了您所看到的错误的原因。

关于mysql - 一些帮助查找此 SQL 语句中的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15279461/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com