操作类型 | SQL语句 | 目标oracle类型 | 目标mysql类型 | 目标postgres类型 |
---|---|---|---|---|
添加列 | alter table dbo.tb01 add col3 date; | 支持 | 支持 | 支持 |
添加列,允许为空 | alter table dbo.tb01 add col33 int; | 支持 | 支持 | 支持 |
添加列,不允许为空,含有默认值 | alter table dbo.tb01 add col33 int not null default 10; | 异常 | 异常 | 异常 |
添加列,允许为空,含有默认值 | alter table dbo.tb01 add col6 int null default 1; | 支持,无默认值 | 支持,无默认值 | 异常 |
同时添加多列 | alter table dbo.tb01 add col36 int ,col37 varchar(30),col38 date; | 支持 | 支持 | 支持 |
修改列【自定义长度】 | alter table dbo.tb01 alter column col4 char(100); | 支持 | 支持 | 支持 |
修改列名称 | exec sp_rename ‘tb01.col34’,’createtime’ | 不支持 | 不支持 | 不支持 |
删除列 | alter table dbo.tb01 drop column col38; | 支持 | 支持 | 支持 |
添加唯一索引,指定约束名字 | alter table dbo.tb01 add constraint uk_tb01 unique(col36); | 支持 | 支持 | 支持 |
添加唯一索引,不指定约束名字 | alter table dbo.tb01 add unique(col29); | 支持 | 支持 | 支持 |
添加约束,指定约束名字 | alter table dbo.tb01 add check (col15<10); | 支持 | 不支持 | 支持 |
添加约束,不指定约束名字 |
文档更新时间: 2021-09-22 21:38 作者:刘志伟