Turning off referential integrity

R

RobUCSD

Is there a way to turn off referential integrety for all tables in a database
at one shot, and then turn it back on again? I need to clear out a bunch of
test data and was hoping to not have to go into the relationship window and
manually turn off and then on again referential integrety?

Thanks, Rob
 
M

Marshall Barton

RobUCSD said:
Is there a way to turn off referential integrety for all tables in a database
at one shot, and then turn it back on again? I need to clear out a bunch of
test data and was hoping to not have to go into the relationship window and
manually turn off and then on again referential integrety?


If you delete the child records before the parent records,
you will not create a referential integrity violation. If
you have a lot of tables and you will be doing this
frequently, try creating a VBA procedure to do the DELETE
queries.
 
D

David W. Fenton

If you delete the child records before the parent records,
you will not create a referential integrity violation. If
you have a lot of tables and you will be doing this
frequently, try creating a VBA procedure to do the DELETE
queries.

Likely best done inside a transaction.
 
Top