I need to pass a list of integers to a stored procedure. When I place the following into the call to the procedure as @loglist = '123123,345345' and declare the variable in the stored procedure as
@loglist text,
then use the expression
AND E.Escalation_ID IN ('@loglist'),
I get an "operand type clash text is incompatible with int. If I take the single quotes out as in
E.Escalation_ID IN (@loglist),...
User Profile
Collapse
-
SQL Server passing a list of integers to a stored procedure
-
Subqueries can not be used as expressions
IN SQL SERVER, subqueries can not be used as expressions in a case statement. Normally, the "IN" would expect more than one record to be returned. -
SQL Server - Error when using % in subquery
I have a query which contains
AND E.escalation_ID IN (CASE WHEN ISNULL(@templat e,0) =0
THEN (E.Escalation_I D)
ELSE (SELECT escalation_ID FROM template_info_T B 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...
No activity results to display
Show More
Leave a comment: