473,387 Members | 1,303 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Deadlock Issue

Hi

Please see the update statements Update 1 and Update 2 below. The table "dataViewRequests" mentioned in the query is a high transactional table where people might be doing an insert, update 1 or update 2 (see queries below). All these statements are in three different SPs. Sometimes when we run Update 1 there has been the error "Transaction (Process ID 156) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction."

This has started occuring of late and has been frequent. Can you let me know what steps I need to take prevent this locking?

Update 1
update dbo.dataViewRequests WITH (ROWLOCK)
set EditVer = @NewStatus,
Requestor = isnull(@Requestor, Requestor),
Approver = isnull(@Approver, Approver),
APPRDNY_DATE = case when @Approver is not null then getdate() else APPRDNY_DATE end,
IBAckDate = case when @IBApprover is not null and @NewStatus='9' then getdate() else IBAckDate end,
IBClDate = case when @IBApprover is not null and @NewStatus='99' then getdate() else IBClDate end,
IBApprover = isnull(@IBApprover, IBApprover),
ContractApprover = isnull(@ContractApprover, ContractApprover),
contractCloseDate=case when @ContractApprover is not null then getdate() else contractCloseDate end
where PriKey in (select id from applications.dbo.udf_string_splitString(@RequestId ,','))

Update 2
update dataViewRequests
set Approver = tmp.RSM,
EditVer = tmp.NewStatus,
Apprdny_date = getdate()
from dataViewRequests dv
inner join (select PriKey [RequestId],
@Approver [RSM],
case when c.SiteNumber is not null and dv.actionType = 2 then 7 else 6 end [NewStatus]
from dbo.udf_string_splitString(@RequestIds, ',') requests
inner join dbo.dataViewRequests dv (nolock) on dv.PriKey = requests.id
left join dbo.dataViewContractSummary c (nolock) on c.SiteNumber = dv.equipment
) tmp on tmp.RequestId = dv.PriKey


-- After Update there is a select
select dv.equipment, dv.deInstalldate
from dbo.udf_string_splitString(@RequestIds, ',') requests
inner join dbo.dataViewRequests dv (nolock) on dv.PriKey = requests.id
where EditVer = 7
Aug 21 '08 #1
0 991

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

Similar topics

1
by: Robert Brown | last post by:
I have a deadlock that's happening on one oracle instance but cannot be reproduced on any other. It is always caused by the same SQL statement colliding with itself and only happens under very high...
1
by: New MSSQL DBA | last post by:
I have recently been assigned to take over several MSSQL environments and found some of the existing practice confusing. As most of my previous experiences are on Oracle and Unix platform so would...
1
by: jtwright | last post by:
I've got a view that creates a parent child relationship, this view is used in Analysis Services to create a dimension in a datastore. This query tends to deadlock after about 10 days of running...
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...
15
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried)...
2
by: Dragan | last post by:
Hi, We're working in VS 2005, Team edition, if it makes any difference at all (should be up-to-date and all that, but could not guarantee it is 100%). We've implemented a simple generic wrapper...
4
by: raccoon | last post by:
keep getting an ora-04020: deadlock detected while trying to lock object XDB. XDNDBKDJjilnd The statement I'm trying to issue is: REVOKE execute on abc."descript_T" FROM PUBLIC; I am not...
1
by: kalpacx | last post by:
Hi All, I am a newbie to db2 database. Currently i am facing an issue which i know for sure that many would have faced and resolved. I am running 6 sql scripts concurrently against the db ...
1
by: =?Utf-8?B?TUt1YmljaW5h?= | last post by:
We’re continuing having a problem with a production application. The application uses ASP.NET web services and about once a day, the web services stop responding. The only resolution is to...
0
by: desmondgreen | last post by:
We have a problem with transaction management/concurrency when using ADO to update a database on a SQL 2005 database. We have a test application, to isolate and demonstrate the problem, where a VB6...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...

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.