How do I delete rows from different tables atomically?
Table A has a primary key and foreign key into Table B.
How do I delete rows from different tables atomically?
Table A has a primary key and foreign key into Table B.
The standard solution is to use ON DELETE CASCADE for your constraint. Search for 'cascade' on that page.
If that is not an option, this SO question may interest you: In SQL Server 2005, can I do a cascade delete without setting the property on my tables?