Once you load up the script into SSMS and refresh the databases tree item, you will see a new database called cte_demo that includes 2 tables.
dbo.Departments
The first table is called dbo.Departments and it contains 17 rows with a number of store departments with the top level departments being indicated by a parent of NULL, and subdepartments having actual parent ID’s.
dbo.Royalty
The dbo.Royalty table contains several generations of the British Royal Family family tree. We will use these for some interesting hierarchical queries.
Stored Procedures
This database also includes 2 stored procedures to rebuild the Departments table as we will be changing data in that table as we test different scripts.
Downloadable Scripts
Download one of the following scripts and run it in SQL Server Management Studio to set up the CTE_DEMO database for use in several samples.
This script is intended to be run on a test or development server and is not intended to be run on a production system.