April 2, 2003 at 3:25 am
Try using IDENT_CURRENT
Have a look in BOL. A few examples included.
Crispin
Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!
April 2, 2003 at 5:38 am
I use scope_identity() myself - only in SQL2K.
Andy
April 2, 2003 at 6:42 am
Thanks for assistance.
IDENT_CURRENT seemed to do the trick. Although I was forced to enter the name of the table.
Help much appreciated.
April 2, 2003 at 2:29 pm
Watch out for ident_current though, as it returns the latest identity-value on a table, from any connection. So if you're connection inserts a value, then a second connection inserts a value before you manage to run ident_current you will get the second value. Use scope_ident as Andy suggested instead.
--
Chris Hedgate @ Apptus Technologies (http://www.apptus.se)
April 2, 2003 at 7:50 pm
Use SCOPE_IDENTITY in this case. There's a reason it's called that - because it retrieves the ID within the scope of your proc. IDENT_CURRENT should only be used to obtain the ID of the most recent entry in a table (not necessarliy from your proc's insert).
keith
keith
April 2, 2003 at 11:05 pm
SCOPE_IDENTITY it is then.
Once again, many thanks for contributions.
Viewing 6 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply