473,473 Members | 1,918 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Avoide DeadLock Condition

rakesh201180
4 New Member
[IMG]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot.jpg[/IMG]Need help....!! I have this stored procedure which is run by Multiple Users at the same time and it is causing deadlock sometimes. Sometimes it is causing deadlock at update and sometimes at insert. I am also using rowlock. Any changes need to be made or if I am doing anything wrong?


Thanks !



CREATE PROCEDURE [dbo].[spSecPriceUpdate]

(@RunID int)

AS

Begin Tran t1

UPDATE tblB_SecPrice WITH (ROWLOCK)
SET SecID = M.SecID
FROM tblB_SecPrice B, tblSecMaster M
WHERE B.Security = M.Label AND
B.RunID = @RunID


UPDATE tblB_SecPrice WITH (ROWLOCK)
SET PropertyID = M.IntA
FROM tblB_SecPrice B, tblMapIIS M
WHERE B.Source = M.StrC AND
M.MapID = 22 AND
B.RunID = @RunID


INSERT INTO tblResultFlt with (ROWLOCK)
(RunID, SecID, PropertyID, PropertyValue, AsOfDate)
SELECT RunID, SecID, PropertyID, Price AS PropertyValue, AsOf AS AsOfDate
FROM tblB_SecPrice B WITH (ROWLOCK)
WHERE B.SecID IS NOT NULL AND
B.PropertyID IS NOT NULL AND
B.Price IS NOT NULL AND
B.AsOf IS NOT NULL AND
B.RunID = @RunID


DELETE FROM tblB_SecPrice WITH (ROWLOCK)
WHERE SecID IS NOT NULL AND
PropertyID IS NOT NULL AND
Price IS NOT NULL AND
AsOf IS NOT NULL AND
RunID = @RunID
Jan 14 '09 #1
2 2334
rakesh201180
4 New Member
I am trying while Loop for date increment
But that also cousing Deadlock.
Any one help any other thing to remove while loop

While(@Fromdate<@Todate)
begin


SET @FROMDATE=@FROMDATE+1
End

tHANKS
Jan 14 '09 #2
ck9663
2,878 Recognized Expert Specialist
Do you really need to issue ROWLOCK? And do you have the necessary index on those tables?


-- CK
Jan 14 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: P.Xman | last post by:
Hi all, I have a strange behaviour where the AppContext.get() is waiting for lock of a HashMap that is not locked by any other task. This freezes my GUI because the AWT-EventQueue wants to stop...
7
by: Andrew Mayo | last post by:
Here's a really weird one for any SQL Server gurus out there... We have observed (SQL Server 2000) scenarios where a stored procedure which (a) begins a transaction (b) inserts some rows into...
2
by: Alex | last post by:
I was hoping someone could confirm my understanding of how InnoDB handles deadlocks (error 1213) and timeouts (error 1206). The way I understand it, with AUTOCOMMIT=0, if I issue 3 SQL statements...
1
by: Rohit Raghuwanshi | last post by:
Hello all, we are running a delphi application with DB2 V8.01 which is causing deadlocks when rows are being inserted into a table. Attaching the Event Monitor Log (DEADLOCKS WITH DETAILS) here....
1
by: Serdge Kooleman | last post by:
WinForms, how to override/avoide the tab order for a bunch of buttons/textboxes? i have a panel with 4 textboxes (or buttons) in 2 comlumns (so 2 and 2) i would like to scroll in the first...
4
by: Sefi | last post by:
Good day everyone I'm a bit confused about whether the "Server Application Unavailable" status of my website that frequently occurs when several users are simultaneously logged into it is a symptom...
13
by: Jonathan Amsterdam | last post by:
I think there's a slight design flaw in the Queue class that makes it hard to avoid nested monitor deadlock. The problem is that the mutex used by the Queue is not easy to change. You can then...
1
by: djpeg | last post by:
Hi, I have query something like this: select * from emp where sal > ( select avg(sal) from emp ) for update When ran multithreaded environment, i used to get this error "Abnormal end unit of...
3
by: Pallav singh | last post by:
Hi All , is there a debugger available to find which thread's are in DeadLock when we have more than two critical section protected with muxtex? How to come out of this condition ? Thanks...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.