Partitioning Tables and Indexes

Creating a partitioned table, index, or indexed view is very similar to creating a non-partitioned table, index, or indexed view. Every object that is created has an ON clause that specifies where the object is stored. However, the ON clause is routinely omitted, causing objects to be created on the default filegroup. Since a partition scheme is just a definition for storage, partitioning a table, index, or indexed view is a very straight forward process.

An example of a partitioned table is as follows:

CREATE TABLE Employee (EmployeeID         int         NOT NULL,
                        FirstName         varchar(50) NOT NULL,
                        LastName          varchar(50) NOT NULL)
ON mypartscheme(EmployeeID);

The key is the ON clause. Instead of specifying a filegroup, you specify ...

Get Microsoft® SQL Server® 2008 Step by Step now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.