Thursday, January 17, 2013

TSQL List Indexes for Specific Table


USE AdventureWorksDW2008R2
GO

SELECT
            so.name AS TableName
            , si.name AS IndexName
            , si.type_desc AS IndexType
FROM
            sys.indexes si
            JOIN sys.objects so ON si.[object_id] = so.[object_id]
WHERE
            so.type = 'U'    --Only get indexes for User Created Tables
            AND si.name IS NOT NULL
            AND so.name = 'FactInternetSales'
ORDER BY
            so.name, si.type 

No comments:

Post a Comment