sql server - SQL Case statement not working -
I am writing a SQL query and it works, but I get only half results:
< Pre> (like Q1.VariableName when @Variablename IS NULL THEN ('E%') ELSE @Variablename END)
What I want is: If the @VerbalName If not, q1 .VariableName = @Variablename.
If it is zero, then 'q%' such as' e% 'or q1.VariableName such as q1.VariableName and' b1% 'is not like'% 1'VARIABLENAME '% MAIL%'
< / Pre>But, I'm unable to get it. Does anyone tell me where I am going
If you are doing this, then where
section, you Case
Completely:
((@Variablename IS NULL and (q1.VariableName 'e' 'or q1.VariableName such as' B% 'and q1.VARIABLENAME'% MAIL % ')) Or q1.VariableName = @Variablename) Since null
is never equal to anything, q1.VariableName = @Variablename )
is always @Variablename
null
Comments
Post a Comment