IDENT_CURRENT


IDENT_CURRENT:

  Returns the last identity value generated for a specified table or view. The last identity value generated can be for any session and any scope. 

Syntax:

IDENT_CURRENT( 'table_name' )

Paramters:

table_name

  Is the name of the table whose identity value is returned. table_name is varchar, with no

default.

Return Value:

numeric(38,0)

Returns - NULL on error or if a caller does not have permission to view the object.

The function however differs by its scope and session from @@IDENTITY and SCOPE_IDENTITY

IDENT_CURRENT returns the last identity value generated for a specific

table in any session and any scope.

@@IDENTITY returns the last identity value generated for any table in

the current session, across all scopes.

SCOPE_IDENTITY returns the last identity value generated for any table

in the current session and the current scope.

When the IDENT_CURRENT value is NULL (because the table has never contained rows or has been truncated), the IDENT_CURRENT function returns the seed value.

 References :  MSDN