日期:2014-05-18 浏览次数:20403 次
select 'alter table '+OBJECT_NAME(object_id)+ ' ADD CONSTRAINT col_'+ name + 'DEFAULT 0 FOR '+name+';' from sys.columns where system_type_id = 108
------解决方案--------------------
执行下面语句后,把结果拷贝到分析器,再执行就可以. select 'alter table '+OBJECT_NAME(object_id)+ ' ADD CONSTRAINT col_'+ name + 'DEFAULT 0 FOR '+name+';' from sys.columns where system_type_id = 108
------解决方案--------------------
select 'alter table '+object_Name(a.id) + ' add constraint DF_'+a.name+' default 0 for '+a.name
from sysColumns a
inner join systypes b on a.xusertype=b.xusertype
where b.name='numeric'