Thursday, July 9, 2009


in sql if we declare column as a Identity columen,as if we want to retrieve the last inserted value then use this

All SQL Server functions that retrieve the last inserted value into the Identity column of a table - @@IDENTITY, SCOPE_IDENTITY, IDENT_CURRENT are similar functions in that they return the last value inserted into the IDENTITY column of a table.

Use SCOPE_IDENTITY() , if you are not sure, if some triggers are going to be written or not on a table. Or, even better, use IDENT_CURRENT(tablename) to be more specific.

for more details

No comments:

Post a Comment