SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Archives: October 2011

Remove All Foreign Keys

To clear test data from a database we could use truncate commands but sometimes we need to get rid of foreign keys.

we could get constaint list from INFORMATION_SCHEMA.TABLE_CONSTRAINTS table.

for example :

we could remove foreign key by using this table and the following query.


Read more

3 comments, 28,585 reads

Posted in SQL Server Tips on 11 October 2011