Jon Galloway
-- t-sql scriptlet to drop all constraints on a tableDECLARE @database nvarchar(50)
DECLARE @table nvarchar(50)
set @database = 'GenApp'
set @table = 'ParamDescriptor'
DECLARE @sql nvarchar(255)
WHILE EXISTS(select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where constraint_catalog = @database and table_name = @table)
BEGINselect @sql = 'ALTER TABLE ' + @table + ' DROP CONSTRAINT ' + CONSTRAINT_NAME
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where constraint_catalog = @database and
table_name = @tableexec sp_executesql @sql
END

0 comments:
Post a Comment
Cool , check also:
This nice link
This nice link
This nice link