ON DELETE CASCADE syntax

  • I want to alter table so as to make all the FK ON cascade delete.

    the tables are already made.

    I need syntax just to alter the constraint and make on cascade delete

    on

    Tried looking at BOL but the syntax didnt work

    Can anyone pls gimme the syntax to alter a constraint to make on cascade delete on

  • khushbu.kumar (8/22/2008)


    I want to alter table so as to make all the FK ON cascade delete.

    the tables are already made.

    I need syntax just to alter the constraint and make on cascade delete

    on

    Tried looking at BOL but the syntax didnt work

    Can anyone pls gimme the syntax to alter a constraint to make on cascade delete on

    You will need to drop, and then create these constraints, sort of like:

    ALTER TABLE dbo.myTable DROP CONSTRAINT fkName

    GO

    ALTER TABLE dbo.myTable ADD CONSTRAINT

    fkName FOREIGN KEY (columnInfoOnSource)

    REFERENCES dbo.myTargetTable(columnInfoOnTarget) ON DELETE CASCADE

    Regards,

    Andras


    Andras Belokosztolszki, MCPD, PhD
    GoldenGate Software

  • ahhh it seems I will have to drop constraint and then again recreate it...

    my head goes twisted when i think of doing it on production db..!!!

    Thanks for the help

    I dont why the dev dont follow some best practices.

    hey but can anyone list the best practices for optimal perf of db for dev

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply