How to Alter Constraint

后端 未结 2 860
再見小時候
再見小時候 2020-11-30 00:52

SQL How to Alter Constraint

Below is 1 of my constraint

CONSTRAINT ACTIVEPROG_FKEY1 FOREIGN KEY(ActiveProgCode) REFERENCES PROGRAM(ActiveProgCode),
<         


        
2条回答
  •  既然无缘
    2020-11-30 01:27

    You can not alter constraints ever but you can drop them and then recreate.

    Have look on this

    ALTER TABLE your_table DROP CONSTRAINT ACTIVEPROG_FKEY1;
    

    and then recreate it with ON DELETE CASCADE like this

    ALTER TABLE your_table
    add CONSTRAINT ACTIVEPROG_FKEY1 FOREIGN KEY(ActiveProgCode) REFERENCES PROGRAM(ActiveProgCode)
        ON DELETE CASCADE;
    

    hope this help

提交回复
热议问题