December 12, 2007 at 12:09 pm
I have a proc that inserts into a table. I grab the @@Identity of the new ID after the insert. I also have an After Insert Trigger on this table.
When this trigger runs it inserts into another table that creates an ID.
The problem is the @@Identity that I'm attempting to get from the intial table is the ID from the table the trigger inserts into.
I'm not quite sure how to handle this... how can I get just the ID from the intial table?
December 12, 2007 at 12:39 pm
Use scope_identity() instead of @@identity.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
December 12, 2007 at 12:42 pm
Reading Help helps a lot.
_____________
Code for TallyGenerator
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply