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 2008 Forums
 Transact-SQL (2008)
 Deadlock

Author  Topic 

psfaro
Starting Member

49 Posts

Posted - 2011-04-15 : 12:22:50
Hi

I've a table due to his structure have some deadlocks

One example of data is

Col1(varchar) col2(value)
3
31
311
3111
31111
36
366

----
The table is updated with in a trasaction with stored Proc that receives 2 arguments (conta, valor) and must update the table like this :
ex: Exec contab('366',100)

It must update col2 of records 366,36,3

ex: Exec contab('31111',100)

It must update col2 with the value sended of records 31111,3111,311,3

The Table Index is optimized, but sometimes i got deadlocks ,when some users are updating the tabel at the some time ,

THis can me avoided ?

Regards

Pedro Faro

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-04-15 : 13:23:19
You can take a table lock or lock a token which should alleviate the deadlocks but will slow everything down.


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-04-15 : 14:28:18
Switch traceflag 1222 on. That will result in a deadlock graph been written to the error log every time a deadlock occurs. Post the result of that graph here.

DBCC TRACEON(1222,-1)


--
Gail Shaw
SQL Server MVP
Go to Top of Page

Jahanzaib
Posting Yak Master

115 Posts

Posted - 2011-04-17 : 10:47:21
which type of index on this table

Clustered or NonClustered ?

Regards,

Syed Jahanzaib Bin Hassan
MCTS,MCITP,OCA,OCP,OCE,SCJP,IBMCDBA

My Blog
www.aureus-salah.com
Go to Top of Page
   

- Advertisement -