title: Update existing database values from spreadsheet
body: <p>I have an existing MSSQL database where the values in some columns need updating according to a spreadsheet which contains the mappings of old data and new data.</p>
  
  <p>The spreadsheet is like this:</p>
  
  <pre><code>       | OLD DATA      | NEW DATA      |
  RECORD | A | B | C | D | A | B | C | D |
  1      |OLD|OLD|OLD|OLD|NEW|NEW|NEW|NEW|
  2      |OLD|OLD|OLD|OLD|NEW|NEW|NEW|NEW|
  </code></pre>
  
  <p>Where ABCD are the column names, which relate to the database, and OLD / NEW relates to the data.</p>
  
  <p>Thus for each line (approx 2500  rows)</p>
  
  <p>The database values that match OLD in each column, need to be changed to NEW</p>
  
  <p>My current thoughts are to do it in a similar way to this:
  <a href="https://stackoverflow.com/questions/9639491/sql-statement-that-updates-an-oracle-database-table-from-an-excel-spreadsheet">SQL Statement that Updates an Oracle Database Table from an Excel Spreadsheet</a></p>
  
  <p>Essentially getting Excel to formulate a list of replace statements, though this feels like a horribly convoluted way to deal with the problem!</p>
  
  <p>Is there a way to have SQL cycle though each row of the spreadsheet, check all records for a=old, b=old2, c=old3, d=old4 and then replace those values with the appropriate a=new, b=new2, c=new3, d=new4?</p>