Home Forums SQL Server 2005 T-SQL (SS2K5) how to check multiple combinations of a variable for null RE: how to check multiple combinations of a variable for null

  • or use (gasp) COALESCE 😉

    select @searchvar = case when COALESCE(@var1,@var2,@var3) is null and @var4 is not null then 'RESULT' else '1' end

    But we believe the OP is trying to use @var4 as a search string, and @var1,@var2,@var3 are used to tell the procedure which column to search on.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills