Sql Server - Using id of updated row as argument in delete statement -


i have trigger this:

create trigger action_voided on action     after update     begin         if update (voided)             begin                 delete user_actions action_id = ? -- here need id of action updated on voided column             end     end: 

and need hold on id of row updated trigger, , use id argument of delete statement. doing research can't figure how use inserted/deleted tables combination make work.

thank help!

not sure if solve problem if want "id" column of row getting updated, can use inserted magic table here. following should modified trigger you. have not tested please pardon syntax errors if any. if let me know modify answer accordingly.

create trigger action_voided on action after update begin     if update (voided)         begin             delete user_actions              action_id in (select id inserted)         end end: 

hope helps.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -