A similar question has been asked here
Anyway i get a syntax error i cannot figure.
This is my code:
declare @MyParameter integer
se @MyParameter = Set At Runtime (could be -1 or any value >=1)
SELECT manyfields FROM manyjoinedtables
where
case when @MyParameter> -1 then
(FIELD1 **=** @MyParameter AND ANOTHERFIELD = Value**)**
end -- note: in case @MyParameter = -1 i do not want to add where condition
Anyway Management studio underlines in red the 2 chars surrounded by ** above.
Why? Where is the syntax error?