By Javier Callico on
1/27/2009 12:00 AM
Today I needed to delete all foreign key contrains in a SQL 2005 database in order to be able to sync it using the Visual Studio Data Compare Tool. I found a script doing almost what I needed but after running it I noticed that it also dropped indexes and defaults in all the schemas. I made some changes to accomplish the following:
1- Drop foreign key contrains only.
2- Filter by schema.
3- Don't execute the drop statements automatically just print them.