Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Deadlock Issue

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-26 : 08:58:34
Alvin writes "Hi

I am having issues when the same SQL queries run simultaneously from diiferent ASP App threads is getting deadlocked.

The deadlock is for a query, which calls a Stored Proc. The stored Proc has a transaction, inside of which it does the following

Alter Proc DoSomething
BEING
BEGIN TRANSACTION TRAN1
SELECT * from TABLEA -- captures values in local variables
DELETE from TABLEA
INSERT into TABLEB -- values captured from TABLEA
COMMIT TRANSACTION TRAN1
SELECT @V1, @V2 from TABLEA -- same as in first step
END

It is the DELETE that is causing a Deadlock

Would really appreciate help on this

Thanks
Alvin"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-05-26 : 09:00:31
Why are you deleting the entire table? Why are you "capturing values into local variables" if you're going to insert them all into the other table.

It would be better to post your actual code, not some generalized example. As written now (which doesn't work) you will not be able to avoid deadlocking.
Go to Top of Page
   

- Advertisement -