Link to home
Start Free TrialLog in
Avatar of 25112
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)?
Avatar of 25112
25112

ASKER

logic in case:

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';
SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial