Lesson 1: Converting a Table to a Hierarchical Structure


Applies To: SQL Server 2016

Customers who have tables using self joins to express hierarchical relationships can convert their tables to a hierarchical structure using this lesson as a guide. It is relatively easy to migrate from this representation to one using hierarchyid. After migration, users will have a compact and easy to understand hierarchical representation, which can be indexed in several ways for efficient queries.

This lesson, examines an existing table, creates a new table containing a hierarchyid column, populates the table with the data from the source table, and then demonstrates three indexing strategies. This lesson contains the following topics:

This lesson requires the AdventureWorks2012 sample database.

Examining the Current Structure of the Employee Table

Lesson 2: Creating and Managing Data in a Hierarchical Table

Community Additions