Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
killme
Starting Member
1 Post |
Posted - 2013-04-06 : 12:19:01
|
Hi. I need to write procedure that should be executed by trigger(on update). In procedure I need to know the ids of affected rows(by update). How can I get it? SQL server. Thx |
|
Jeff Moden
Aged Yak Warrior
652 Posts |
Posted - 2013-04-07 : 12:20:24
|
I've not tried them in a trigger before (I try to avoid any heavy lifting in triggers), but you might be able to use Table-Valued Parameters here. Please look for "parameters [SQL Server], table-valued" (without the quotes) in Books Online (press the {f1} key to get there). Then, just populate the Table-Valued Parameter from the INSERTED logical trigger table and use it in the call to the stored procedure. Of course, the stored procedure will need to be modified to use the new Table-Valued Parameter.--Jeff Moden RBAR is pronounced "ree-bar" and is a "Modenism" for "Row By Agonizing Row".First step towards the paradigm shift of writing Set Based code:"Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column." When writing schedules, keep the following in mind:"If you want it real bad, that's the way you'll likely get it." |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-09 : 00:16:24
|
i would prefer doing the processing inline in trigger without need to call another procedure------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|