Find all clustered indexes

  • Hi, I am looking for a script to find out all clustered indexes which are not in primary file group. Please help.

  • Something along the lines of this should get you started

    Select * from sys.indexes

    Where index_id = 1

    And data_space_id > 1

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

  • This is an improvement

    selectOBJECT_NAME(i.object_id) AS TableName

    , i.name AS IndexName

    , FILEGROUP_NAME(i.data_space_id) AS FileGrpName

    from sys.indexes i inner join sys.objects o

    on i.object_id = o.object_id

    where i.index_id = 1 and o.is_ms_shipped <> 1

    and i.data_space_id > 1

    -----------------------------------------------------------------------------------------------------------

    "Ya can't make an omelette without breaking just a few eggs" 😉

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

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