title: sqlsrv update where not all passed vars have data
body: <p>I am making a form for employees to update their demographics, address, phone, email, etc. The information is placed in a processing table that is then processed to on file on Mondays. I didn't want to place multiple lines in the processing table for one person, so the scenario that someone comes in on Tuesday with a new address and then comes back on Thursday with a new phone, gets updated on the same line.
  I've done this:</p>
  
  <pre><code>UPDATE PendingProcessing 
  SET Street1 = ISNULL(NULLIF('{$addr1}',''), Street1), 
      Street2 = ISNULL(NULLIF('{$addr2}',''), Street2), 
      Email = IsNull(NULLIF('{$email}',''), Email), 
      CellPhone = IsNull(NULLIF('{$cellPhone}',''), CellPhone), 
      HomePhone = IsNull(NULLIF('{$homePhone}',''),HomePhone), 
      City = IsNull(NULLIF('{$city}',''), City), 
      State = IsNull(NULLIF('{$state}',''),State), 
      Zip = IsNull(NULLIF('{$zip}',''),Zip), 
      DateOfChangeRequest = '{$date}' 
  WHERE  Clock = '{$username}';  
  
  IF (@@ROWCOUNT = 0) 
  BEGIN 
      IF (NOT EXISTS( SELECT * FROM PendingProcessing WHERE  Clock = '{$username}' ))
      BEGIN 
          INSERT INTO PendingProcessing 
          (
              Clock, 
              Street1, 
              Street2,  
              Email, 
              CellPhone, 
              HomePhone, 
              City, 
              State, 
              Zip, 
              DateOfChangeRequest
          ) 
          VALUES 
          (
              '{$username}', 
              '{$addr1}',
              '{$addr2}',
              '{$email}',
              '{$cellPhone}',
              '{$homePhone}',
              '{$city}',
              '{$state}',
              '{$zip}',
              '{$date}'
          ); 
      END; 
  END;
  </code></pre>
  
  <p>But the problem is that if there is an address in the Street1 column when a phone number comes in it only leaves the first character in Street1. </p>
  
  <p>The short way is to make the user enter their new address again when entering their new phone number because the first address update was still pending processing. I would prefer to make the code do the extra work though.</p>
  
  <p>So, my question is how can I update columns only when I have data to update them with? I don't want to null existing data, but I also don't want to not update something that has data, say the user entered their new phone number and realized after saving that they had made a typo and needed to change that number.
  Thanks for your help.</p>