,QUOTENAME(OBJECT_NAME(kc.parent_object_id)) Order by QUOTENAME(OBJECT_SCHEMA_NAME(kc.parent_object_id)) INSERT INTO #workTable (Command) VALUES ('PRINT ''- DROP CLUSTERED KEYS -''') Īnd o.name not in ('dtproperties','sysdiagrams') - not true user tables INSERT INTO #workTable (Command) VALUES ('PRINT ''- DROP FOREIGN KEY CONSTRAINTS - COMPLETE'' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10)') INNER JOIN sys.schemas AS sch ON sch.schema_id = fk.schema_id INSERT INTO #workTable (Command) VALUES ('PRINT ''- DROP FOREIGN KEY CONSTRAINTS -''') * the work table to execute pregenerated commands. * To do this it will create a work table and populate it with the commands to execute then iterate through * This Script will perform the following operations: Guess I should get to that at some point, but until then, here you go: I just never actually published it to my blog. Well, luckily for you, I did this very thing a few months back.
0 Comments
Leave a Reply. |