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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Oct 8, 2013, 6:03 AM
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/
Sanjeeb LenkaPosted Oct 8, 2013, 8:08 AM
Bineesh ViswanathPosted Oct 8, 2013, 7:30 AM
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.
Jignesh TrivediPosted Oct 8, 2013, 6:07 AM
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.