O'Reilly logo

Foundations of SQL Server 2008 R2 Business Intelligence, Second Edition by Guy Fouché, Lynn Langit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating A HIERARCHYID Table

First, create an employee containing a HIERARCHYID. The employee table will have the following attributes: a unique record identifier, the employee's name, the employee's position, and the employee's level in the company. Create the employee table in the AdventureWorksDW2008R2 database by entering and executing the following T-SQL code in an SSMS query:

CreateTabledbo.EmployeeHierarchy (   EmployeeID IntIdentity (1, 1)NotNull Primary Key,   Name Varchar(50)NotNull,   Position Varchar(50)NotNull,   OrganizationLevel HierarchyID ); Go

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required