1.更改表名
alter table 表名 rename to 新表名
2.更改字段名
alter table 表名 rename 字段名 to 新字段名
3,更改字段类型
如:ID 字段 原类型为 character varying(50) 新类型为integer
其中,ID中原有数据为1,2,3等数字
用如下语句更改
alter table dbo.titemtype alter column id type integer using to_number(id,'9');
本文详细介绍了使用SQL语句修改数据库表名、字段名以及字段类型的步骤,包括更改表名、字段名和字段类型的特定语法。以ID字段为例,展示了如何将原有字符型数据转换为整型数据。
1.更改表名
alter table 表名 rename to 新表名
2.更改字段名
alter table 表名 rename 字段名 to 新字段名
3,更改字段类型
如:ID 字段 原类型为 character varying(50) 新类型为integer
其中,ID中原有数据为1,2,3等数字
用如下语句更改
alter table dbo.titemtype alter column id type integer using to_number(id,'9');
2157

被折叠的 条评论
为什么被折叠?
