3

How do I delete rows from different tables atomically?

Table A has a primary key and foreign key into Table B.

Jeff Atwood
  • 63,320
  • 48
  • 150
  • 153
hanin
  • 31
  • 1

1 Answers1

6

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?

Community
  • 1
  • 1
jwd
  • 10,837
  • 3
  • 43
  • 67