Sir, I need your help in the following:-
what is the difference between scope identity and @@Identity?
please explain this with an example.
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Oct 8, 2013, 2:03 AM EDT
refer to this link
http://www.c-sharpcorner.com/UploadFile/rohatash/identity-and-scope_identity-in-sql-server-2012/
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 8, 2013, 2:07 AM EDT
hi,
@@IDENTITY : returns the last indentity value generated for any table in current session.
SCOPE_IDENTITY returns the last identity value generated by any table in current session in current scope.
It might possible both returns different value for current session if multiple table insert is occured.
Please refer
http://blogs.msdn.com/b/spike/archive/2009/10/20/my-take-on-identity-vs-scope-identity.aspx
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/
hope this will help you.
Bineesh ViswanathRank #1,680 · 907 reputationPosted Oct 8, 2013, 3:30 AM EDT
But the idea of SCOPE_IDENTITY() is still far away. So need help in this.
could you give a clear idea that when this function generate?
I know that this function generate during value insertion.
Could you give me your own idea about SCOPE_IDENTITY?
I not need any website link for this.
Sanjeeb LenkaRank #301 · 8.3K reputationPosted Oct 8, 2013, 4:08 AM EDT