2

I have Table A and Table B on SQL Server.

Table B has an foreign key to Table A.

I want to cascade delete Table B itens when I delete a Table A item.

How to set this on SQL Server and on Entity Data Model?

programad
  • 1,291
  • 3
  • 19
  • 38

2 Answers2

1

On the SQL server, set the Delete Rule in INSERT and UPDATE specification on the relationship property to Cascade.

podiluska
  • 50,950
  • 7
  • 98
  • 104
  • Where? On the foreign key properties of this relationship? I had this doubt because it is not intuitive. It doesn't say wich end of the relationship it reffers. Thanks, man. – programad Aug 20 '12 at 13:35
  • 1
    Yes. The cascade delete will apply when the "master" is deleted, deleting all the "children" – podiluska Aug 20 '12 at 13:38
0

Set CASCADE on the relationship in the Entity Model Designer...

Martin Milan
  • 6,346
  • 2
  • 32
  • 44