Find filegroup for table

  • I have a table PracticeAccountants. I want to know on which filegroup this table resides. This DB has two filegroups 1. Priamry which is not default. 2. TestOnly which is default.

    I know to find this by using 'create script' in SSMS. Is there any T-sql command to do that?

    -lk

  • use this code.

    SELECT o.[name], o.[type], i.[name], i.[index_id], f.[name]

    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]

    WHERE i.data_space_id = 2

    refer: http://www.mssqltips.com/tip.asp?tip=1112



    Pradeep Singh

  • Awesome Pradeep. Thanks

  • Glad I could help 🙂



    Pradeep Singh

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

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