Tag: Tables

SQL: List of tables and indexes, with associated File Group

The script within this post returns a list of all tables (along with the schema name), and indexes (where they exist), and the name of the associated file group.

This will useful to find out which objects have been assigned to the wrong file group.

I have a database with over 10 file groups, and wanted to find out why there was over 50Gb of data in the PRIMARY file group, even though there were only a couple of tables in that group. When I ran this script, I discovered there were some indexes that had been incorrectly created in the PRIMARY group!!!