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.