SCOPE_IDENTITY Concurrency

Hi,

Can anyone tell me or point me to any theory that using SCOPE_IDENTITY is isolated to the user who is performing the action, i.e. separate thread?. i.e. so If I call SCOPE_IDENTITY I will  get the value I require from the correct INSERT and not one that may have happened after my insert but before it executes the SCOPE_IDENTITY

Thanks in advance

Andrew
LVL 20
REA_ANDREWAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
yes, SCOPE_IDENTITY() is doing exactly that: it gives you the identity value of YOUR scope (and session).

note:
@@identity
-> will give the same results, except if you have a trigger on the table that itself inserts to another table with identity
ident_current('table_name')
-> will give the current identity of the table, ignoring the scope (so would give you the identity generated by other users eventually)

0
 
REA_ANDREWAuthor Commented:
excellent cheers.

Andrew
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.