0

I have two table and I want to switch on cascade on delete via Query and not via SSMS GUI.

tblEmployee

Name  GenderId

tblGender

Id    Gender

Scenario: Suppose I have already put the foreign key constraint on tblEmployee tblEmployee_GenderId_Fk and now at a later stage I want to add Cascade on Delete, how to achieve it. I looked into the documentation and it tells the query to add the Cascade on Delete while creating the FK Constraint. But suppose I forgot to add Cascade that time. Then how can I add it later. Something like below

Alter table tblgender ON DELETE CASCADE;    

Documentation

Unbreakable
  • 7,776
  • 24
  • 90
  • 171
  • 1
    Looks like there is already an [answer](https://stackoverflow.com/questions/4454861/how-do-i-edit-a-table-in-order-to-enable-cascade-delete). Please check if it will work for you (people propose to drop and recreate the constraint) – Evgeny Soynov Dec 21 '17 at 21:10
  • Turns out, only way out is to drop the constraint and ReAdd it with the cascade on delete. – Unbreakable Dec 21 '17 at 21:11
  • Someone please mark this question as Duplicate. I don't think I can with the SO Points I have. – Unbreakable Dec 21 '17 at 21:13

0 Answers0