How do I change the following code to an if statement that returns a boolean 0 or 1 value? I am trying to test our database to make sure that when VariableA = 2, VariableB = 1,2,3,4 or 6. I want it to exclude all other VariableA values in my results. I am using MSSQL 2014.
Select
(Case when @variableA = 2
and (@variableB = 1 or @variableB = 2 or @variableB = 3 or @variableB = 4 or @variableB = 6)
and . . . = . . .
then 0 else 1 end) as <whatever>,
from ...
Aucun commentaire:
Enregistrer un commentaire