title: Blocking empty strings to be written into SQL database table
body: <p>I have a program that will update a production database on data point change. However, the embedded script in the program performs a blanket update of an entire row, but what I want it to do is just to partially update values in specified columns. I do not have the time to learn the script and make whatever changes I need, so I tried setting the other columns to Not Null in attempt to block the "" values written from the program.</p>
  
  <pre><code>ALTER TABLE `scheduling` 
  CHANGE COLUMN `Priority` `Priority` VARCHAR(5) NOT NULL ,
  CHANGE COLUMN `PurchaseOrder` `PurchaseOrder` VARCHAR(45) NOT NULL ,
  CHANGE COLUMN `PartID` `PartID` VARCHAR(45) NOT NULL ,
  CHANGE COLUMN `OrderQty` `OrderQty` VARCHAR(20) NOT NULL ,
  CHANGE COLUMN `DeliveryDate` `DeliveryDate` VARCHAR(20) NOT NULL ,
  CHANGE COLUMN `ReadyToRun` `ReadyToRun` VARCHAR(10) NOT NULL ,
  CHANGE COLUMN `LF5` `LF5` VARCHAR(45) NOT NULL ,
  CHANGE COLUMN `CompletionTime` `CompletionTime` VARCHAR(45) NOT NULL ;
  </code></pre>
  
  <p>But this method did not work, the values in the database still got overwritten by "" from the script. Is there a way to prevent columns in the database to be overwritten by empty values?</p>
  
  <p>Here is my database table after the blanket update:</p>
  
  <p><a href="https://i.stack.imgur.com/Qds6o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qds6o.png" alt="enter image description here"></a></p>
  
  <p>The intention of the update is just to use work order as PK and update the associated completion time.</p>
  
  <p>I've located the update query in the script:</p>
  
  <pre><code>method ODBCConnection.Update (row)
  {
      local       query = "";
      local       n, len;
      local       value, retval, cols;
  
      if (!row.__primary_key || !row..(row.__primary_key))
      {
          error ("Update: Row is not identifiable - primary key not set");
      }
      else
      {
          query = string ("update ", row.__table, " set ");
  
          len = length(row.__columns);
          n = 0;
          with name in row.__columns do
          {
              if (name != row.__primary_key)
              {
                  value = row..name;
                  query = string (query,
                                  n &gt; 0 ? ", " : "",
                                  name, " = ", ODBC_ValueString(value));
                  n++;
              }
          }
          query = string (query, " where ", row.__primary_key, " = ",
                          ODBC_ValueString (row..(row.__primary_key)));
  
  //      princ (query, "\n");
  
          .Statement().FreeStmt (SQL_CLOSE);
          retval = .Query (query);
          if (retval != -1)
              retval = .StoreResult();
          else
              error (.Error());
      }
      retval;
  }
  </code></pre>
  
  <p>And I changed the query part to:</p>
  
  <pre><code>if (name != row.__primary_key)
          {
                              name = "CompletionTime";
              value = row..name;
              query = string (query, name, " = ", ODBC_ValueString(value));
  
          }
  </code></pre>
  
  <p>That did not work either.</p>