>Hi,
>
>Do you think the following two approaches of getting the last entry in the identity column always give the same result?
>
>
>select IDENT_CURRENT( 'table_name' )
>
>
>
>select top 1 IdentColumn from table_name group by IdentColumn order by IdentColumn desc
>
>
>And if yes, am I correct in assuming that the first method (using IDENT_CURRENT()) would be a faster way of getting the value?
>
>TIA.
The correct way is to use OUTPUT clause of the INSERT command. The second best method is to use SCOPE_IDENTITY() function. All other methods should not be used.
See this blog post
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/
If it's not broken, fix it until it is.
My Blog