Archives: October 2011
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…