clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2335923 fiddles created (27468 in the last week).

create table t (atr1 int, atr2 int); insert into t values (1, 15),(2, 30),(3, 45),(1, 30),(2, null),(3, 90); declare @var1 int = 2; declare @var2 int = 30; select * from t where atr1 = @var1 and ( (@var2 not in (3, 4) and atr2 is null) or (@var2 in (3, 4) and atr2 = @var2) )
atr1 atr2
2
 hidden batch(es)