Lesson 1: Converting a Table to a Hierarchical Structure

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:

Prerequisites

This lesson requires the AdventureWorks2008R2 sample database. For information about how to install the AdventureWorks2008R2 sample database, see Considerations for Installing SQL Server Samples and Sample Databases.