用sql脚本添加删除表里面字段,代码:
复制代码 代码示例:
use asm
——–删除字段
if exists (select * from syscolumns where id =object_id(‘tb_log’) and name=‘COLUMN1′)
ALTER TABLE [tb_log ] DROP COLUMN [COLUMN1]
if exists (select * from syscolumns where id =object_id(‘tb_log’) and name=‘COLUMN2′)
ALTER TABLE [tb_log ] DROP COLUMN [COLUMN2]
if exists (select * from syscolumns where id =object_id(‘tb_log’) and name=‘COLUMN3′)
ALTER TABLE [tb_log ] DROP COLUMN [COLUMN3]
if exists (select * from syscolumns where id =object_id(‘tb_log’) and name=‘COLUMN4′)
ALTER TABLE [tb_log ] DROP COLUMN [COLUMN4]
———添加字段
alter table tb_log
add COLUMN5 nvarchar(200),
COLUMN6 int