Main Page Sitemap

Scope identity returns null


Scope identity returns null

If you call the procedure multiple times, those are different scopes, so SCOPE _IDENTITY is expected to be null. And you need to be careful about concepts - if you call the procedure multiple times, how is the second invocation really going to be sure.
But really that is the least efficient way to do this. Some other tidbits: Always specify schema prefix Use semi-colons to terminate statements. Wrap your procedure body with BEGIN /END and use SET NOCOUNT ON; Do not use IDENT _CURRENT.
Some other concurrent call to the same procedure? Consider table-valued parameters so that you only have to call the stored procedure once, and you can stop tracking if this call is inserting the "first" row and worrying about multiple users colliding: CREATE TYPE PLabStagingDetails AS.




983
Sitemap