jerry li

博客园 首页 联系 订阅 管理

declare @string varchar(8000)
while exists(select name from sysobjects where xtype='c')
begin
 select top 1 @string='alter table ['+b.name+'] drop constraint '+a.name
  from (select parent_obj,name from sysobjects where xtype='c') a,
        (select id,name from sysobjects where objectproperty(id, N'IsUserTable') = 1) b
    where a.parent_obj=b.id
 exec(@string)
print @string
end

posted on 2009-12-23 14:13  jerry li  阅读(277)  评论(0)    收藏  举报