title: Complicate SQL Amount split by percentage in same row transpose (Pivot)?
body: <p>I am struggling to split total amount field into percentage in the same row and then update the last column with Amount type for which the percentage is applied.</p>
  
  <p>Example data<br></p>
  
  <pre><code>        Total Amount |  UF%  | UFI%     |RA%    |RL%    |NP%    | AmountType
  
              100      |0.00   |20        |9.15   |0.75   |70.01  
              1520.23  |64.4   |19.1      |15.5   |0.25   |0.75   
              158520.03|13.25  |35        |2.25   |19.28  |30.22  
  </code></pre>
  
  <p>I have to get percentage of total amount column and then transpose  insert them as additional rows  in the same table and upate the last column what type of amount it is.</p>
  
  <p>For example for 1st row  I can get  5 new rows</p>
  
  <pre><code>Total Amount    Amount type
   0              UF%
   20             UFI%
   9.15           RA%
   0.75           RL%
   70.01          NP%
  </code></pre>
  
  <p>I am one step at a time to I have created 5 new columns  to calculate the percentage as TotalAmount UF%, TotalAmount UFI%,  TotalAmountRA% and so on…
  Selec t  [Total Amount]* UF% as  [TotalAmount UF%] … and so on.</p>
  
  <p>I am stuck here shall I use Pivot/unpivot? Or case ?
  Or is it any other easier way to use row over partition by ?</p>
  
  <p>Please suggest.</p>
  
  <p></p>