DEFINITIONS
Definitions More Info.
Definition ID
766
Title
SQL
Category
NOTES
Definition
How can foreign key constraints be temporarily disabled using T-SQL?
Definition Description
http://stackoverflow.com/questions/159038/how-can-foreign-key-constraints-be-temporarily-disabled-using-t-sql
-- disable all constraints
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all"
-- enable all constraints
exec sp_MSforeachtable @command1="print '?'", @command2="ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"
RecordBy
cunay
Record Date
12-12-2016 15:59:46
Düzenle
Kopyala
Sil