DROP AND CREATE ALL FOREIGN KEYS IN SQL SERVER

If you have ever worked with a migration team as a DBA or have any migration experience then you must have used this kind of script in your database career. I don’t know about you but I have had many situations where I had to drop all the foreign keys and then do my operations on the database and at the end create them back. Before you drop any foreign keys from a database, you need make sure that you have the create script safe somewhere with you. Here is the script that I use to generate all foreign keys.

Prasad Sahoo

Prasad Sahoo, is an enthusiast of Microsoft technologies in general and a passionate database professional, mainly focusing on SQL Server performance tuning and business intelligence. He has contributed a long time of his career working on SQL Server and other RDBMS. If he is not busy with SQL stuff then he must be watching some Hollywood movies.

Leave a Reply

%d bloggers like this: