I need to free up space quickly on a certain drive, to do so means deleting some data and then shrinking that file group. So I need to be able to quickly identify which tables belonges to which file group - this data is available in Management Studio, but its not easy or convenient to get via the GUI. The following script will list every table and its filegroup.
select o.Name as TableName, fg.groupname as FileGroupName
from sysobjects o
inner join sysindexes i
on i.id = o.id
inner join sysfilegroups fg
on i.groupid = fg.groupid
where type = 'U'
and i.indid in (0,1)