MySql 執行語句錯誤 Err] 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


關於用Power Designer 生成sql文件出現 錯誤  [Err] 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 'int not null auto_increment comment '用戶id',  

的解決辦法

 

sql語句如下 

 1 drop table if exists tb_users;
 2 
 3 /*==============================================================*/
 4 /* Table: tb_users                                              */
 5 /*==============================================================*/
 6 create table tb_users
 7 (
 8    userid               national int not null auto_increment comment '用戶id',
 9    orgid                int comment '組織id',
10    username             varchar(50) not null comment '姓名',
11    account              varchar(50) comment '賬號',
12    password             varchar(100) comment '密碼',
13    sex                  varchar(10) comment '性別',
14    phone                varchar(100) comment '電話',
15    duties               varchar(100) comment '崗位職務',
16    mail                 varchar(100) comment '郵箱',
17    personstatus         char default '0' comment '人員狀態(0在職,1離職)',
18    accountstatus        char default '0' comment '賬號狀態(0正常,1注銷)',
19    enabletime           datetime comment '賬號登錄有效時間',
20    newaddtime           datetime comment '新增時間',
21    updatetime           datetime comment '更新時間',
22    operater             varchar(36) comment '操作人',
23    lastloadtime         datetime comment '最后登錄時間',
24    bz1                  varchar(200) comment '備注1',
25    bz2                  varchar(200) comment '備注2',
26    bz3                  varchar(200) comment '備注3',
27    primary key (userid)
28 );
29 
30 alter table tb_users comment '用戶表';
31 
32 alter table tb_users add constraint FK_Reference_11 foreign key (orgid)
33       references tb_organize (orgid) on delete restrict on update restrict;

執行后出現如下錯誤,

[Err] 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 'int not null auto_increment comment '用戶id',
   orgid                int com' at line 6

  解決辦法:

是否發現執行的sql語句中多了個national關鍵字,把這個關鍵字去掉就可以。

在podwer designer 中設置如圖:把前面對號去掉就可以

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 解決:[Err] 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 ERROR 1064 (42000): 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 php"> [Err] 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 ''

php Mysql語法錯誤之> 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' ERROR 1064 (42000): 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 '11. set password for 'root'@'localhost' 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 '"id", 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 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1 Django進行數據遷移時,報錯:(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 '(6) NOT NULL)' at line 1") SQL語句報錯:You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near MySql 執行語句錯誤:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to usenear 'bookName like '%Java%'' at line 1

 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM