Scope_Identity function.....

  • Hi All,

    What is the difference between

    select @value=scope_identity()

    and

    select @value=scope_identity() from table

    Regards,
    [font="Verdana"]Sqlfrenzy[/font]

  • scope_identity() function returns the last inserted identity value across any table within a stored procedure(within scope).

    select @value=scope_identity() ---will return the last inserted identity value within that scope.It may be identity value of any other table used in that SP.

    select @value=scope_identity() from table ----i dont think this will be used.

    Instead to know the last inserted identity value for a table,use ident_current(TableName)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply