title: SQL stored procedure variable null checking
body: <p>Below is part of a stored procedure that I have, it would be of great help if you can point me why is that even when <code>@DefaultID</code> is null after executing the select statement it does not enter the if condition, is there are different method I have to follow to assign the value to <code>@DefaultID</code> for it to be available for null checking. </p>
  
  <p>Thank you in advance.</p>
  
  <pre><code>DECLARE @DefaultID varchar(25)
  DECLARE @ISDefault varchar(1)
  
  SELECT @DefaultID = (SELECT TABLE1.DEFID as DEFID
                       FROM TABLE1
                       WHERE TABLE1.ID = '123')
  
  IF (@DefaultID = '')
      SET @ISDefault = '1'
  ELSE
      SET @ISDefault = '0'
  </code></pre>