I have a query which contains
AND E.escalation_ID IN (CASE WHEN ISNULL(@template,0) =0
THEN (E.Escalation_ID)
ELSE (SELECT escalation_ID FROM template_info_TB WHERE field_name LIKE '%'+@template+'%')
END
This throws the multiple results error
If the last line is changed to LIKE 'g', the query doesn't throw the error.
I am using the '%'+@variable+'%' in a regular query and have no problem at all.
I can't use EXISTS because I need an "IN" list.
Is this a known bug in SQL Server 2005?