powerdesigner 16.5 生成的sql语句在mysql数据库无法成功执行

    xiaoxiao2022-06-27  49

    导入由powerdesigner 16.5生成的sql文件到mysql执行时报出如下问题。

    问题1:varchar类型的字段报错。

    解决:varchar类型的字段添加长度。

    问题2:自增字段报错。

    生成的sql文件内容如下:

    create table scnu_homework_answer ( answer_id bigint not null auto_increment tenant_id bigint not null answer_iscorrected smallint not null answer_tea_isdeleted smallint not null answer_stu_isdeleted smallint not null ); alter table scnu_homework_answer add primary key (answer_id); 原因:表的自增属性是先设置的,但是表的主键的自增是在表建立之后进行的,所以mysql才会报错。

    解决:在对生成的sql文件选项进行设置时,将默认的outside改成inside即可。

    转载请注明原文地址: https://ju.6miu.com/read-1124165.html

    最新回复(0)