SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Use of Identity Property to Resolve Concurrency Issues


Use of Identity Property to Resolve Concurrency Issues

Author
Message
alishahryar
alishahryar
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 60
I came to add exactly the same point - SCOPE_IDENTITY() would guarantee that the just-inserted rows' newly-generated IDENTITY value would be unique.
Ajit Ananthram
Ajit Ananthram
SSC Journeyman
SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)SSC Journeyman (83 reputation)

Group: General Forum Members
Points: 83 Visits: 282
alishahryar (3/26/2013)
I came to add exactly the same point - SCOPE_IDENTITY() would guarantee that the just-inserted rows' newly-generated IDENTITY value would be unique.

As mentioned earlier, the scope_identity function has been known to generate incorrect values at times (when queries make use of parallel execution plans). Refer to this link for more information --> http://support.microsoft.com/kb/2019779

Ajit Ananthram
Blog - http://ajitananthram.wordpress.com
alishahryar
alishahryar
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 60
OK, that's good information regarding the bug affecting @@IDENTITY and SCOPE_IDENTITY(). According to the article you provided, the bug is fixed in 2008 R2 SP 1 and above. Thanks for pointing this out.
JJ B
JJ B
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1121 Visits: 2860
NBSteve: Wow. That was so kind of you to take the time to write that out. Not wordy in the slightest. Instead, it was *clear.* I greatly appreciated it!

(Also thank you to the original author. I enjoy articles that explains a person's process/thinking. And also thank you to Paul for posting your interesting solution.)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search