title: SQL Loop through table of tables names and insert
body: <p>As part of a SSIS package I have a SQL table containing the staging table name and corresponding 'real' table name.  The staging table names will change based on the date but there is a previous step that works out what the Real_Table is.</p>
  
  <p>How do I loop through each one in SQL and insert all the data from the staging tables (columns are identical in both) into the real table and update the flag from 0 to 1 to mark it was done.  This is my table:</p>
  
  <pre><code>Staging_Table            Real_Table     UpdateFlag
  Customers_01012018       Customers      0
  Order_01012018           Order          0
  Suppliers_02022018       Suppliers      0
  </code></pre>