title: Null value column and NOT EXISTS T-sql
body: <p>I'm trying to do the following:</p>
  
  <pre><code>IF NOT EXISTS ( 
                  SELECT  *   
                  FROM    [tbl_web_company] 
                  WHERE   [name]          = @name
                  AND     [address1]      = @address1
                  AND     [address2]      = @address2
                  AND     [city]          = @city
                  AND     [province_id]   = @province_id
                  AND     [postal_code]   = @postalcode
                  AND     [contact_phone] = @phone
                  AND     [contact_fax]   = @fax
                  AND     [deleted]       = dbo.pvd_fn_getDeletedDate(@id, @active))
          BEGIN
              SELECT 'update'
          END
          ELSE
          BEGIN
              SELECT 'no update'
          END
  </code></pre>
  
  <p>I'm basically trying to see if any of the columns have changed, but I'm having problems when @province_id and dbo.pvd_fn_getDeletedDate(@id, @active) are NULL in the database, and are both set as NULL. </p>
  
  <p>Province ID is an INT - Nullable</p>
  
  <p>Deleted is a Datetime - Nullable.</p>
  
  <p>If the record in the database has NULL for both these values, then this will always select 'update'. Which is wrong as [province_id] and [deleted] are NULL.</p>
  
  <p>Any suggestions how to handle NULLS in this case?</p>