July 8, 2009 at 7:40 am
I need to return the value of the identity column after an insert of a new record. How can this be done in a SP?
Thank you in advance
Jim
July 8, 2009 at 7:43 am
Take a look at Scope_Identity in Books Online or on MSDN.
- 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
July 8, 2009 at 7:49 am
Thank you!!
Jim
July 8, 2009 at 7:55 am
SCOPE_IDENTITY() is fine for simple inserts but be aware of the following parallelism bug:
http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=328811
July 9, 2009 at 7:12 am
Ken McKelvey (7/8/2009)
SCOPE_IDENTITY() is fine for simple inserts but be aware of the following parallelism bug:http://connect.microsoft.com/SQL/feedback/ViewFeedback.aspx?FeedbackID=328811
I hadn't seen that bug. Good to know about.
- 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
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply