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.
while(exists(select 1 from INFORMATION_SCHEMA.TABLE_CONSTRAINTS…
2 comments, 6,114 reads
Posted in SQL Server Tips on 11 October 2011



Subscribe to this blog