TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ashok kumar
NA
71
0
Deadlock
May 23 2014 2:42 PM
I have procedure for handling transaction detail there is aprox 60 user access my application for saving data at once(i.e.) this procedure will be hit by all user at once. My proc like this
Create Proc InsertUpdateData
As
Begin
Set tran Isolation Level Serializable
Begin Tran
Begin Try
Declare @SeqNo BigInt
select @SeqNo=TblVal+1 from GetSeq Where Year=2014 AND ColName='Tbl1'
update GetSeq set TblVal=@SeqNo Where Year=2014 AND ColName='Tbl1'
--- Some Insertion and updation in different different table
--------------------------
----- End of insertion and updation
Commit tran
End Try
Begin Catch
return -1
Rollback
Insert into ErrorLog Select ERROR_LINE(),ERROR_MESSAGE()
End catch
End
But In a day i got deadlock problem in line
select @SeqNo=TblVal+1 from GetSeq Where Year=2014 AND ColName='Tbl1'
update GetSeq set TblVal=@SeqNo Where Year=2014 AND ColName='Tbl1'
while i use sql heartbeat for detecting deadlock.
I have use Transaction level
Serializable for avoiding phantom,dirty and repeatable read.
This
GetSeq table has
TableName column
TblVal(this will increase when i use update query to Getseq)
Can Any one help me how can i avoid deadlock with using
Serializable isolation level for this
Reply
Answers (
2
)
how to solve this or finding second maximum without subquery
sql query to count column values from multiple tables and su