The following excerpt, courtesy of Que Certification, is from
Chapter 10 of the book MCAD/MCSD/MCSE Training Guide (70-229): SQL Server 2000 Database Design and Implementation by Thomas Moore and Ed Tittel. Click for the complete book excerpt series or purchase the book.
STEP BY STEP - 10.1
Creating a clustered index using code
- Open the Query Analyzer by selecting Query Analyzer from the Start menu.
- Create a new index on a new table. To do this, first create a new table in the Pubs database. In the code pane, type in the following:
use Pubs go CREATE TABLE IndexPractice ( YourName char(32) NULL, Age integer NULL, BirthDate integer NULL )
- After creating a new table, create a new clustered index. To do this, code in the following:
CREATE CLUSTERED INDEX age_index ON IndexPractice (age)
- To see your new index, open the Query Analyzer, expand the Pubs database in the Object Browser, and then expand User Tables. Expand IndexPractice and then expand Indexes. If you followed the steps properly, you should see age_index listed below Indexes.
Click for the complete book excerpt series.
This was first published in January 2006
Join the conversationComment
Share
Comments
Results
Contribute to the conversation