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