Deadlock in delete-select?

You need to enable some trace flags on your db so you get a printout in your log that explains the deadlock chain.

You need to enable some trace flags on your db so you get a printout in your log that explains the deadlock chain. Try starting SQL server with trace flags 1204,1205 and 1206. Then post the deadlock chain.

You could try escalating the locks on in your sql, its possible this will fix it but without the chain printout its impossible to tell So perhaps this will help: delete from tb_intervaloServico where idFeriado in ( select ints. IdIntervalo from tb_periodicidadeServico ps, tb_intervaloServico ints with (updlock,serializable) where ints. IdPeriodicidadeServico=ps.

IdPeriodicidadeServico and idservicoContrato='7f20b4af-9076-48f9-a861-8b78273eadc3' and fromFixa=0).

Looks like your query is self-locking. You might want to read this newsgroup thread (specially the posting of Santeri Voutilainen) about this problem. It's likely an issue with SP4.

You could try to reduce the query parallelism by reducing the numbers of processors used for query execution. For that you might use the query hint OPTION (MAXDOP n) where n is the number of parallel threads. Setting n = 0 means using all available processors.

Alternatively you can also set the option globally: in Enterprise Manager under "Properties - Processor - Parallelism" click the radio button next to "Use" and select 1.

Try changing your query to: delete tis from tb_intervaloServico tis where tis. IdFeriado in ( select ints. IdIntervalo from tb_periodicidadeServico ps, tb_intervaloServico ints where ints.

IdPeriodicidadeServico=ps. IdPeriodicidadeServico and idservicoContrato='7f20b4af-9076-48f9-a861-8b78273eadc3' and fromFixa=0) or maybe: delete tis from tb_intervaloServico tis inner join tb_intervaloServico ints on tis. IdFeriado = ints.

IdIntervalo inner join tb_periodicidadeServico ps on ints. IdPeriodicidadeServico = ps. IdPeriodicidadeServico and idservicoContrato='7f20b4af-9076-48f9-a861-8b78273eadc3' -- add the correct table prefix for idservicoContrato and fromFixa = 0 -- add the correct table prefix for fromFixa You can test those queries before delete using select * instead of delete.

The following article will guide you through how to troubleshoot deadlocks in SQL Server 2000. msdn.microsoft.com/en-us/library/aa93757...).aspx Let me know if you require specific assistance. Cheers, John.

Your deleting from a table your joining to, tb_intervaloServico. Dump your subquery in a temp table and use the temp table in your delete. Select ints.

IdIntervalo into #deleteMeId from tb_periodicidadeServico ps, tb_intervaloServico ints where ints. IdPeriodicidadeServico=ps. IdPeriodicidadeServico and idservicoContrato='7f20b4af-9076-48f9-a861-8b78273eadc3' and fromFixa=0) delete from tb_intervaloServico where idFeriado in ( select * from #deleteMeId ).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions