Question : t-sql if statement containing two requirements doesn't work

The following T-SQL won't run:

if((@col1 = null) & (@col2 = null))
      SET @something = ''

But this will:

if(@col1 = null)
BEGIN
if(@col2 = null)
      SET @something = ''
END

Why won't the first one run? It's exactly the same thing.

Answer : t-sql if statement containing two requirements doesn't work

The following is the correct syntax

IF @col1 IS NULL AND @col2 IS NULL
  SET @something = ''
Random Solutions  
 
programming4us programming4us