title: Considering empty string to null in query
body: <p>I am using <code>sql server R2</code>. I have a stored procedure in which I am passing two paramaters as <code>@username varchar(100)</code> and <code>@password varchar(100)</code>. </p>
  
  <p>Now,  when I create user from my application first time, the password will be NULL. </p>
  
  <p>I want to make a query which return record for matching username and password. The problem is code is passing <code>empty string</code> to <code>stored procedure</code>. I want something that consider or convert <code>empty string to NULL</code> automatically. I already have solution for this using <code>if condition</code> but I want to use single query, not if condition.</p>
  
  <p><strong>EDIT :</strong> </p>
  
  <p>Its a simple stored procedure : </p>
  
  <pre><code>CREATE PROCEDURE [dbo].[Pro_TblP]
  (
   @userName varchar(100),
   @password varchar(100) 
  )
  AS
  BEGIN
      IF (@password ='')
          BEGIN
              SELECT * FROM TblP 
              WHERE username = @userName AND password IS NULL AND IsDeleted = 0
          END
  
      ELSE 
          BEGIN
              SELECT * FROM TblP 
              WHERE username = @userName AND password = @password AND IsDeleted = 0
      END
  END
  
  GO
  </code></pre>
  
  <p>I want to combine the query in single representation. Don't want the if condition.</p>