How's this for weird.
The following query is times out. While it is running an exclusvie Extent lock is created in temp db which doesn't let go.
If i use a differnet periodid in the sub query then it works fine. (Even if the result set in the sub query is larger).
I also find it works if I create a temp table from the sub query:
I'm really stumped here. Can anyone explain this?
Cheers
Yael
The following query is times out. While it is running an exclusvie Extent lock is created in temp db which doesn't let go.
Code:
SELECT jobid FROM INVSwitchTransvalidtbl
WHERE JobID IN (SELECT JobID FROM INVJobsTbl WHERE periodid = 23)
If i use a differnet periodid in the sub query then it works fine. (Even if the result set in the sub query is larger).
I also find it works if I create a temp table from the sub query:
Code:
SELECT JobID into #jobs FROM INVJobsTbl WHERE periodid = 23
SELECT jobid FROM INVSwitchTransvalidtbl WHERE JobID IN (select jobid from #jobs)
I'm really stumped here. Can anyone explain this?
Cheers
Yael