Hi Tracy,
Not sure what did you want to prove with these two links, since both recommend SCOPE_IDENTITY() :)
>I disagree. I think it depends on how you make your updates and if there are any triggers or child tables and what identity you are trying to verify. SCOPE_IDENTITY() is limited to values inserted only within the current scope while @@IDENTITY is not. It is limited by session only. I guess he could use IDENT_CURRENT if he wanted to limit it to a specific table and he didn't care which connection added the record. I know most recommend SCOPE_IDENTITY() in case triggers are added later, but it really depends. This discussion is moot anyway since he doesn't have any identity columns. :o)
>
>I posted a link for him, but I also like this description:
>
>
http://www.dotnetjunkies.ddj.com/Article/86F0988E-FED4-414F-BA2E-D01D953C11BE.dcik>
>and this:
>
>
http://blog.sqlauthority.com/2007/03/25/sql-server-identity-vs-scope_identity-vs-ident_current-retrieve-last-inserted-identity-of-record/>
>
>
>
>
>>>If I remember correctly, @@IDENTITY doesn't apply to GUIDs, right? I am using uniqueidentifiers....
>>>
>>
>>No, it doesn't apply. You can create new GUID with NewID()
>>
>>Also it's much better and safer to use SCOPE_IDENTITY() to get the newly created ID.
>>
>>>>We have an identity column on every table and use @@IDENTITY to check inserts:
>>>>
>>>>
http://www.kamath.com/tutorials/tut007_identity.asp>>>>
If it's not broken, fix it until it is.
My Blog