在sql server中修改字段类型和字段名称 --以下是完整的sql执行语句 if exists(select * from syscolumns where id=object_id('数据表名称') and) --判断该字段是否存在 begin alter table 表明 alter column 字段名 varchar(64);--更改类型 end go if exis
在sql server中修改字段类型和字段名称
--以下是完整的sql执行语句
if exists(select * from syscolumns where id=object_id('数据表名称') and) --判断该字段是否存在
begin
alter table 表明 alter column 字段名 varchar(64);--更改类型
end
go
if exists(select * from syscolumns where id=object_id('表名') and) --判断该字段是否存在
begin
exec sp_rename '表明。旧字段名', '新字段名', 'column'; --更改字段名称 sp_rename 为数据存储过程