Home > T-SQL-Scripts > List All Objects Created on All Filegroups in a Database

List All Objects Created on All Filegroups in a Database

How can I find which object belongs to which filegroup. Is there any way to know this?

 

SELECT quotename(schema_name(o.schema_id)) +’.’+ quotename(o.[name]) ObjectName,
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 = f.data_space_id
AND o.type = ‘U’ –and f.name=’DataFileGroup’

 

image_thumb

Categories: T-SQL-Scripts
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: