I want to give an expression for a result in a
case expression in SQL Server. When I checked the
Simple CASE expression: CASE input_expression WHEN when_expression THEN result_expression [ ...n ] [ ELSE else_result_expression ] END Searched CASE expression: CASE WHEN Boolean_expression THEN result_expression [ ...n ] [ ELSE else_result_expression ] END
I want give result_expression as the following example query.
select * from mytable where CASE WHEN col1='12' THEN col2 like '%12%' ELSE col3 like '%12%' END
but it giving the error
Incorrect syntax near the keyword 'like'.
Is there any possibilities for this?