• SELECT

    o.[name] AS ObjectName,

    o.[type] AS ObjectType,

    s.[name] AS SchemaName,

    f.[name] AS [Filename],

    i.[name] AS PrimaryKey,

    i.[index_id] AS IndexID

    FROM

    sys.indexes i

    INNER JOIN

    sys.filegroups f

    ON

    i.data_space_id = f.data_space_id

    INNER JOIN

    sys.all_objects o

    ON

    i.[object_id] = o.[object_id]

    INNER JOIN

    sys.schemas s

    ON

    s.[schema_id] = o.[schema_id]

    order by

    s.[name],

    o.[name]