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 |
|
Ishamael
Starting Member
14 Posts |
Posted - 2006-09-27 : 01:57:07
|
| End of the day so I wont be replying for a few hours.And I know I should look through the forums, will do tomorrow if no one replys:PYou know how @@Identity gives you the row you just inserted.. is there a similar way to get the idenity of a row you just updated.. Its for a trigger. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-09-27 : 02:16:31
|
| Use the inserted and/or deleted tables.Peter LarssonHelsingborg, Sweden |
 |
|
|
eyechart
Master Smack Fu Yak Hacker
3575 Posts |
Posted - 2006-09-27 : 02:23:22
|
You would use the INSERTED table. The INSERTED table (and the DELETED table) contain a copy of the rows prior to being modified. You can just select out the identity value from this special table during your update operation.check BOL regarding triggers for more infomation. EDIT: -ec |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-09-27 : 13:18:35
|
| "is there a similar way to get the idenity of a row you just updated [in a trigger]"Note that the INSERTED and DELETED pseudo-tables can contain MULTIPLE records - so be careful to write your triggers to assume multiple rows, rather than just a single row!Kristen |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
Ishamael
Starting Member
14 Posts |
Posted - 2006-09-27 : 18:47:43
|
| Thanks guys will look into it :) |
 |
|
|
|
|
|