The following SQL statement sometimes creates locks on my mssqlserver 2000 server
delete from tb_intervaloServico
where 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)
For some reason, the deletion gets a lock status and does not end (?). The only other process that I think is blocked by this is a maintenance plan that works on the weekend to recreate indexes, so I have no idea what could cause the problem.
These are the locks generated by the deletion ...
Object Lock Type Mode Status Owner
tb_intervaloServico TAB IX GRANT Xact
tb_periodicidadeServico TAB IS GRANT Xact
Does anyone have pointers on how to get to the root of the problem? I have a suspicion that the tb_intervaloServico table is the root of the lock, because it is called in delete and in select, but I cannot reproduce the behavior.
source
share