Is it possible to change value for Action [ON UPDATE] using ALTER Table

  • Hello All,

    Is it possible to change a column (ON UPDATE Action to CASCADE from NO ACTION in SQL 2005?

    If yes could someone please share an example code for that?

    Thanks

  • can you be more clear? I don't understand what you want.

    If you need to change an update/insert statement you can use an INSTEAD OF trigger (see BOL for explanation).

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • I believe you are asking if you can change the on UPDATE action for a foreign key constraint. You need to drop the constraint and then re-add with the change.

    ALTER TABLE table_name

    DROP CONSTRAINT FK_Name

    Go

    ALTER TABLE table_name WITH NOCHECK ADD CONSTRAINT

    FK_name FOREIGN KEY

    (

    column_name

    ) REFERENCES fk_table_name(

    column_name

    ) ON UPDATE CASCADE

    ON DELETE NO ACTION

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

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