SqlServer修改表字段类型

HoFei / 2023-05-23 / 原文

if not exists (select 1 from syscolumns where name='字段名' and id=OBJECT_ID('表名') and 条件)
begin
    alter table 表名 alter column 字段名 类型 
end
Go