Clearing FK’s and tables from database
Misc July 14th, 2009SELECT 'ALTER TABLE ' + OBJECT_NAME(f.parent_object_id) + ' DROP CONSTRAINT [' + f.name + ']' FROM sys.foreign_keys AS f INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id union all SELECT 'DROP TABLE '+ name FROM dbo.sysobjects WHERE (type = 'u') and name != 'sysdiagrams'


Recent Comments