Hi
I want to insert in sql query something like that:
Select * from Users where id=[if @userId>3 then @userId else "donnt use this condition"] and Name=[switch @userId
case 1:"Alex"
case 2:"John"
default:"donnt use this condition"];
How can i do it?
yet another similar question
When showAll is false it works ok but when showAll is true it returns nothing. Why and how to make it working right? IsClosed column has a bit type.
Select * from orders where IsClosed=CASE WHEN @showAll='false' THEN 'false' ELSE NULL END;