I'm using SQL Server 2005.
Our application almost never deletes without it being a logical delete and therefore we have no need for cascading deletes.
In fact, its quite a comfort knowing that the foreign key contraints give us some protection against an accidental delete statement.
However, very occasionally I need to delete a top level table and all of its children. At the moment I do this with multiple DELETE statements in the write order and it becomes a very large, complex and impossible to keep up to date script.
I'm wondering if there is a way of automatically turning cascading deletes on for all foreign keys in the database, performing my top level delete, and then turning them all back on again?