title: T SQL - null variable
body: <p>I have a stored procedure being called from an .aspx.cs page. I have a parameter that sometimes cannot be sent when the sproc is called. Because of this I'm doing the following:</p>
  
  <pre><code> IF @variable is null
       BEGIN
           ...do this...
       END
   Else 
           ...do that...
  </code></pre>
  
  <p>My problem is in the IF statement. As far as I can tell when I use any of the following:</p>
  
  <ul>
  <li><code>if @parameterVariable = null</code></li>
  <li><code>if @parameterVariable = ''</code></li>
  <li><code>if @parameterVariable &lt;= 0</code></li>
  </ul>
  
  <p>Nothing happens!? When I debug the sproc in SSMS I find that (even though the parameter is empty (no user selection)) that the cursor goes to and runs the code in the ELSE statement. Am I doing something wrong?</p>
  
  <p>Thanks!</p>