MySql 执行语句错误 Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to...

关于用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 中设置如图:把前面对号去掉就可以

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值