title: Convert hierarchical data to Path Style flat (branch) style in SQL Server
body: <p>I have a table in the following hierarchical format
   - Input Example 1</p>
  
  <pre><code>Dim_Name    |Dim_Parent
  G. Manager  |#root
  Assistant   |G. Manager
  Manager     |G.Manager
  Sr Associate|Manager
  Associate   | Sr Associate
  </code></pre>
  
  <p>And I want to convert it into a flat ("branch" like view) table
   - Output Example 1</p>
  
  <pre><code>LVL3      |LVL2      |LVL1        |LVL0      
  G. Manager|Manager   |Sr Associate|Associate
  G. Manager|Assistant |Assistant   |Assistant
  </code></pre>
  
  <p>My requirement is to have a solution which can handle unknown level of hierarchy. For example for the following input : 
   - Input Example 2</p>
  
  <pre><code>Dim_Name    |Dim_Parent
  G. Manager  |#root
  Assistant   |G. Manager
  Manager     |G.Manager
  </code></pre>
  
  <p>My output should be
  - Output Example 2</p>
  
  <pre><code>LVL1      |LVL0         
  G. Manager|Manager   
  G. Manager|Assistant 
  </code></pre>
  
  <p>Any suggestions would really be helpful.</p>