----删除字段约束
select distinct 'ALTER TABLE ' +a.name+ ' drop constraint DF_'+ a.name+'_type'
from pgenius.dbo.sysobjects a inner join pgenius.dbo.syscolumns b on a.id = b.id
where a.xtype = 'U' and b.name = 'genius_type'
---删除表中字段
select distinct 'ALTER TABLE ' +a.name+' DROP column '+B.name from pgenius.dbo.sysobjects a inner join pgenius.dbo.syscolumns b on a.id = b.id
where a.xtype = 'U' and b.name = 'genius_type'
select distinct 'ALTER TABLE ' +a.name+ ' drop constraint DF_'+ a.name+'_type'
from pgenius.dbo.sysobjects a inner join pgenius.dbo.syscolumns b on a.id = b.id
where a.xtype = 'U' and b.name = 'genius_type'
---删除表中字段
select distinct 'ALTER TABLE ' +a.name+' DROP column '+B.name from pgenius.dbo.sysobjects a inner join pgenius.dbo.syscolumns b on a.id = b.id
where a.xtype = 'U' and b.name = 'genius_type'