Query to find out the tables which have clustered and non clustered indexes

  • Can someone please send me a query to find out the tables which have clustered and non clustered indexes in a database?

  • i think this will help;

    look over the case statement, it will help you add an additional WHERe statement to find clustered vs non clustered.

    SELECT OBJECT_NAME(object_id) AS TableName,

    CASE

    WHEN index_id = 0

    THEN 'HEAP'

    WHEN index_id = 1

    THEN 'CLUSTERED'

    ELSE 'Regular Non Clustered Index'

    END AS kind,

    *

    FROM sys.indexes

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply