Manage Learn to apply best practices and optimize your operations.

Quick steps: Creating a clustered index using code

Learn to create a clustered index using code in Query Analyzer in this book excerpt from MCAD/MCSD/MCSE Training Guide (70-229): SQL Server 2000 Database Design and Implementation.

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

  1. Open the Query Analyzer by selecting Query Analyzer from the Start menu.

  2. 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 )
    

  3. 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)
    

  4. 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.

Dig Deeper on SQL Server Database Modeling and Design

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close