Transactions, transactions, transactions.  Don't write another line of
SQL until you learn about transactions.

In this case it doesn't matter because @@identity is bound to the
active connection (and connections are single threaded), but you
should still be transactionally aware.

In addition to transactions, you can also do various types of locking
on the database to serialize access (exactly like CFLOCK), but they
obviously have performance and concurrency ramifications.
Transactions are typically a better way to solve it those types of
problems because their semantics are slightly different and can be
implemented in a more performant manner in most cases.

cheers,
barneyb

On Wed, Apr 28, 2010 at 10:51 AM, Che Vilnonis <[email protected]> wrote:
>
> When using "set nocount on", "select @@identity as xyz" and "set nocount
> off" in a cfquery, how can I be certain that two transactions that occur at
> roughly the same time obtain the proper incremental id from an Identity
> column? Is their a SQl equivalent to CF's cflock tag?
>
> Thanks, Che
>
>

-- 
Barney Boisvert
[email protected]
http://www.barneyb.com/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333187
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to