How to Determine If an Index Is Clustered

Microsoft SQL Server clustered indexes create an ordered list of records on a database. Each table can contain its own clustered index, but you can only create one clustered index on each table. You use SQL Server Management Studio and the SQL language to determine if an indexed is clustered.

Instructions

    • 1

      Click the Windows "Start" button and select "All Programs." Click "Microsoft SQL Server," then click "Management Studio" to open the software.

    • 2

      Log in to your server and click the database in the left panel to activate it. Click "New Query" to open a query editor that points to the activated database.

    • 3

      Type the following code to determine if the specified index is clustered:

      SELECT 'ix_myindex',INDEXPROPERTY(OBJECT_ID('mytable'), 'ix_myindex','IsClustered')

      The above code returns "1" if the index is clustered or "0" if the index is not clustered. Replace "ix_myindex" with the name of your index and replace "mytable" with the name of the table that contains the index.

    • 4

      Press the "F5" key to execute the query. The return results display "0" or "1" to tell you if the selected index is clustered.

Related Searches:

Comments

Related Ads

Featured