title: What is the T-SQL to normalize an existing table?
body: <p>I'd like to convert an existing table into the 1st normal form (simplest normalization possible; see the example).</p>
  
  <p>Do you happen to know what is the T-SQL is for this sort of problem? Many thanks!</p>
  
  <p><img src="https://i.stack.imgur.com/yEVXw.png" alt="enter image description here"></p>
  
  <p><strong>Update</strong></p>
  
  <p>Tried the answer below, it worked perfectly. Here is the steps I used to test the answer:</p>
  
  <ol>
  <li>Start up Microsoft SQL Management Studio.</li>
  <li>Create the tables, with the data below.</li>
  <li>Make sure that the ID in "Customer" is set to "Primary Key", and "identity".</li>
  <li>Make sure that the ID in "Order" has no special settings (its a foreign key).</li>
  <li>Open up a database diagram, then create a 1:* relationship between the "Customer" and "Order" tables.</li>
  <li>Execute the script on the "Customer" table and the "Order" table, it will automatically normalize the data properly for you.</li>
  <li>This is very useful if you are starting from a flat .csv file that has just been imported, and you want to copy the information into a normalized form in the database.</li>
  </ol>