Replies |
Premalatha
Posted on: 7/13/2012 12:10:58 PM
|
Level: Starter | Status: [Member] | Points: 25
|
Returns the last identity value inserted into an identity column in the same scope. A scope is a module: a stored procedure, trigger, function, or batch.
Premalatha
Software Engineer
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Hi
It returns identity of Last Record Inserted in the table
R D Patel
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Sgtammana
Posted on: 7/14/2012 3:40:27 AM
|
Level: Starter | Status: [Member] | Points: 25
|
Hi,
you will get the Latest identity value of the current scope which you are in.
for example:
if you are executing an SP. in that sp you had inserted a record in a table A and the identity value is 10 and also at the same time from the outside another user insert the record in the same table as 11.
if used the scope identity you will get the value as 10.
Tammana
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
CGN007
Posted on: 7/15/2012 11:54:16 PM
|
Level: Silver | Status: [Member] | Points: 25
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Ranjeet_8
Posted on: 7/16/2012 2:53:31 AM
|
Level: Gold | Status: [Member] | Points: 25
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
SELECT @@IDENTITY
SELECT SCOPE_IDENTITY()
The above both sql query returns the last identity value entered into a table in your current session.
SELECT IDENT_CURRENT('tablename')
It returns the last IDENTITY value produced in a table
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
CGN007
Posted on: 7/31/2012 6:12:55 AM
|
Level: Silver | Status: [Member] | Points: 25
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
CGN007
Posted on: 7/31/2012 9:34:00 AM
|
Level: Silver | Status: [Member] | Points: 25
|
Mark as answer if it helps...,That motivates...!!!
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Muhsinathk
Posted on: 9/5/2012 12:33:12 AM
|
Level: Bronze | Status: [Member] | Points: 25
|
Hi,
SELECT SCOPE_IDENTITY()
It returns the last IDENTITY value produced on a connection and by a statement in the same scope, regardless of the table that produced the value.
SCOPE_IDENTITY(), like @@IDENTITY, will return the last identity value created in the current session, but it will also limit it to your current scope as well. In other words, it will return the last identity value that you explicitly created, rather than any identity that was created by a trigger or a user defined function.
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|
Shanky11
Posted on: 9/5/2012 12:55:04 AM
|
Level: Starter | Status: [Member] | Points: 25
|
Sridevi, if this helps please login to Mark As Answer. |
Reply | Alert Moderator
|