sql - Need to asign null into condition by CASE -


i need condition query.

i want work this:

where      [column] = case                   when @variable1 in (1,2)                       null                      else @variable2                end 

but won't work because [column] = null not working on our work sever, sql server 2012.

any ideas?

try this:

where isnull([column],1) = case                 when @variable1 in (1,2)  1                 else @variable2              end 

p.s. change value 1 value not valid [column].


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -