select distinct DropCode = 'alter table [' + ots.name + '].[' + OnTable.name + '] drop constraint [' + fk.name + ']' from sys.foreign_keys fk inner join sys.objects OnTable on fk.parent_object_id = OnTable.object_id inner join sys.schemas ots on OnTable.schema_id = ots.schema_id union select DropCode = 'drop table [' + s.name + '].[' + t.name + ']' from sys.tables t inner join sys.schemas s on t.schema_id = s.schema_id
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.