Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by sdorris-1150234
»
What is the value of SCOPE_IDENTITY()
25 posts, Page 3 of 3
««
«
1
2
3
What is the value of SCOPE_IDENTITY()
Rate Topic
Display Mode
Topic Options
Author
Message
Clive Chinery
Clive Chinery
Posted Monday, April 19, 2010 3:33 PM
Ten Centuries
Group: General Forum Members
Last Login: Friday, September 02, 2011 3:22 AM
Points: 1,227,
Visits: 154
An excellent question! - Thank you!
Post #906380
sdorris-1150234
sdorris-1150234
Posted Monday, April 19, 2010 3:49 PM
SSC Veteran
Group: General Forum Members
Last Login: Friday, July 22, 2011 7:33 AM
Points: 289,
Visits: 433
You're welcome! It gave me a headache one day trying to debug an application, so I thought I'd post the question.
I've learned a great deal from this forum. It's amazing to me how even a simple question can generate a great discussion. That's why I keep coming back.
Post #906388
Paul White
Paul White
Posted Monday, April 19, 2010 10:20 PM
SSChampion
Group: General Forum Members
Last Login: Yesterday @ 4:22 PM
Points: 10,990,
Visits: 10,542
Given the number of inconsistencies and bugs, I'd be quite happy to see @@IDENTITY and SCOPE_IDENTITY removed from the product. I very much prefer the OUTPUT clause for this purpose.
http://connect.microsoft.com/SQLServer/feedback/details/328811/scope-identity-sometimes-returns-incorrect-value
Paul White
SQL Server MVP
SQLblog.com
@SQL_Kiwi
Post #906491
nigel.
nigel.
Posted Tuesday, April 20, 2010 1:59 AM
Ten Centuries
Group: General Forum Members
Last Login: Tuesday, May 21, 2013 7:31 AM
Points: 1,164,
Visits: 2,601
Hugo Kornelis (4/19/2010)
Tough question. We can't really look in the minds of the developers who originally wrote the feature, so we can only speculate.
Very true
And frankly, I see little reason to do an INSERT with an IDENTITY, and then first do another INSERT before testing SCOPE_IDENTITY, ...
Yes, it is a strange thing to do in the first place.
Given the similarlty to @@IDENTITY pointed out elsewhere in this discussion, that might very well even be the originally intended behaviour.
Agreed, given that the documentation for @@IDENTITY is quite clear on this it's odd (at the very least) that it's not covered in the SCOPE_IDENTITY docs.
--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden
Post #906603
vignesh 38804
vignesh 38804
Posted Thursday, June 10, 2010 1:52 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, July 05, 2010 10:56 PM
Points: 230,
Visits: 17
nice question
Post #935204
« Prev Topic
|
Next Topic »
25 posts, Page 3 of 3
««
«
1
2
3
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.