📜  在 sql 代码示例中更改约束

📅  最后修改于: 2022-03-11 15:05:18.045000             🧑  作者: Mango

代码示例1
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