title: How to unpivot this table
body: <p>I have created a temp table that I would like to unpivot it, but I keep getting an error message as follow:
     <strong>Msg 156, Level 15, State 1, Line 196
     Incorrect syntax near the keyword 'for'.</strong></p>
  
  <p>My temp table is below:</p>
  
  <p>Dossier Order Number  T_Code  Routine_Labour  Variable_Labour</p>
  
  <p><img src="https://i.stack.imgur.com/b55mk.jpg" alt="enter image description here"></p>
  
  <p>I would like to unpivot it to below:</p>
  
  <p><img src="https://i.stack.imgur.com/LQZ7I.jpg" alt="enter image description here"></p>
  
  <p>I used the script below:</p>
  
  <pre><code>Select 
  Dossier,
  Order_Number,
  T_Code,
  Labour_Type,
  Amount
  
  from 
  #LabourSplit
  
  Unpivot 
  (
   Amount for Labour_Type in (Routine_Labour, Variable_Labour)
   ) as LabourSplit_U
  </code></pre>
  
  <p>As soon as I run this script, the error message pop up. even I commented out the two columns in the temp table and in the script, the error message is still there. </p>
  
  <pre><code>Select 
  Dossier,
  --Order_Number,
  --T_Code,
  Labour_Type,
  Amount
  
  from 
  #LabourSplit
  
  Unpivot 
  (
   Amount for Labour_Type in (Routine_Labour, Variable_Labour)
   ) as LabourSplit_U
  </code></pre>