25112
asked on
disable constraint/triggers modify data and then enable them again.. is this fail proof?
if you should disable trig/const and then remove/add data and then enable them, is that a good idea that will work every time (as long the data is good)?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
exec sp_Msforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL';
exec sp_Msforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL';
truncate/delete tables.. insert new data.. and then...
exec sp_Msforeachtable 'ALTER TABLE ? WITH CHECK CHECK CONSTRAINT ALL';
exec sp_Msforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL';