On 1/17/07, Doug Bezona <[EMAIL PROTECTED]> wrote:
>
> scope_identity() is preferrable to @@identity.
>
> @@identity will return the latest ID generated by your statement, which
> means if your insert kicks off a trigger, for example, and the trigger also
> uses an ID value, you would get the ID from the trigger, not your main
> insert.
>
> Scope_identity() is restricted to the scope of your main query.
>
> Now, chances are you don't have any triggers in play, but it's better to
> get in the habit of using scope_identity() so you don't have a surprise down
> the road.



Good advice Doug.  I just got bit with this today and was scratching my head
for an hour before I figured it out.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:266846
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to