User Id :    Password :      New Member   Forgot Password  
Topic: How to get the newly generated Id in the table in sql server 2005?
Anamika singh
23 Nov 2010 at 02:49 AM
How to get the newly generated Id in the table in sql server 2005?
Re: How to get the newly generated Id in the table in sql server 2005?
Gaurav
16 Dec 2010 at 02:59 AM
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.

Total Replies: 1
 
Featured Text Ad

Featured Ad