Books online says it better, but in short:

Say your table has a trigger on it, and that trigger inserts something into a 
different table, @@identity returns the ID from the insert caused by the 
trigger, rather than the ID you actually want.

scope_identity() knows what 'scope' you are working with and returns the 
correct ID.

true, not many people will have triggers on their tables that do other inserts 
( I do :-( ), but what if someone else added something like that? it would 
screw up your code.

better to be safe, then sorry I think.



>>> [EMAIL PROTECTED] 20/10/2006 12:29 pm >>>

Scott,

Can you explain why SCOPE_IDENTITY() is better?
 
 
Senior Coldfusion Developer
Aegeon Pty. Ltd.
www.aegeon.com.au 
Phone: +613  8676 4223
Mobile: 0404 998 273
 






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to