Finding your group(file)

Managing tables into filegroups can be a very daunting task when you start to look at huge database systems. The following script always helps me to locate what table is in which filegroup.

It helps to keep things neat and tidy.

SELECT o.name, s.groupname, f.name
FROM dbo.sysfilegroups s
INNER JOIN dbo.sysindexes i
ON i.groupid = s.groupid
INNER JOIN dbo.sysfiles f
ON f.groupid = s.groupid
INNER JOIN dbo.sysobjects o
ON i.id = object_id(o.name)
AND i.indid in (0, 1)

Comments

Popular posts from this blog

List to Table

Service Broker and External Activator for Sql Server...

Turbo Charge Your SSMS