title: Tree Structure With History in SQL Server
body: <p>I'm not sure if it's a duplicate question, but I couldn't find anything on this subject.</p>
  
  <p>What's the best way for storing tree structure in a table with ability to store history of changes in that structure. </p>
  
  <p>Thank you for any help.</p>
  
  <p><strong>UPDATE:</strong> </p>
  
  <p>I have <strong>Employees</strong> Table and I need to store the structure of branches, departments, sections, sub sections.. in a table. 
  I need to store historical information on employees branches, departments, to be able to retrieve an employee's branch, department, section, sub section even if the structure has been changed. </p>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <p>There's a solution to save the whole structure in a history table on every change in the structure, but is that the best approach? </p>
  
  <p><strong>UPDATE 3:</strong></p>
  
  <p>There's also <strong>Orders</strong> Table. I must store employee's position, branch, department, section, sub section and other on every order. That's the main reason for storing history. It will be used very often. In another words I should be able to show db data for every past day.</p>
  
  <p><strong>UPDATE 4:</strong></p>
  
  <p>Maybe using hierarchyid is an option? </p>
  
  <p>What if a node is renamed? What should I do, if I need the old name on old orders? </p>