Comments posted to this topic are about the item Script to kill the top blocker and report what it was doing.
I got this error message when trying to run this script:
(1 row(s) affected)
(0 row(s) affected)
Msg 512, Level 16, State 1, Line 18
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
it error on this line
IF @blocker not in (select spid from sysprocesses where blocked != 0)
The syntax is correct, not using any of the =, !=, <, <= , >, >= operator.
When the script do not find any blocked on the beginning of the script
-- Report on blocking spids to be terminated.
select blocked as "Blocker"
,count(*) as "Victim Count"
where blocked > 0
group by blocked
it did not return error.
Does any one knows what cause the script to fail? I will appreciate any comment.
I added the max expression and fix it.
AND (select max(datediff(ss,last_batch,getdate()) ) FROM sysprocesses where blocked = @blocker) > 5
Viewing 3 posts - 1 through 2 (of 2 total)