Ali Awan wrote:
> Every once in a while on my intranet application I get Database errors.
> MS SQL Server will throw an error that the transaction was deadlocked.
> 
> It happens around a piece of code in which I have 2 queries, an Update and a
> Delete which are nested inside a CFTransaction.

> On this page, the only thing happening is an update query.  I checked the
> date and time that the error occurred and I did not find 2 competing
> transactions, so I was completely baffled as to why a SQL deadlock would
> occur on a page where this just a single query.

Did you find any concurrent queries?


> What I have done is put a CFLock around this, in the hopes that this will
> eliminate this error.

Since you couldn't find any concurrent transactions I doubt that is 
going to help.


> If there are 2 users and they are not hitting the same table, but just
> hitting the same database, could a deadlock situation occur?

For a deadlock you need at least two SQL sessions hitting the same object.


> <cflock>
>    <cftransaction>
>        <cfquery name="q1">
>              update table1
>                  yadda yadda.......
>        </cfquery>
> 
>        <cfquery name="q2">
>                 delete table1
>                  where ......
>        </cfquery>
>    </cftransaction>
> </cflock>

It is not unlikely this can deadlock, but to be certain we need to see 
the actual SQL.

Jochem

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP

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

Reply via email to