I have a vendor product that has 15 filegroups and I would like to determine
what objects(tables,indx..) reside on what filegroup? I used generate
script and looking at each object to see where it was created and this seems
the hard way to go about it. Is there a sp or a script that would list the
objects and where they exist with having to dig through these items.
TIA
CCD
This script has written by Itzik Ben-Gan
create database test
on primary(name = 'datafile1', filename = 'c:\temp\datafile1'),
filegroup user_fg
(name = 'datafile2', filename = 'c:\temp\datafile2')
log on
(name = 'logfile1', filename = 'c:\temp\logfile1')
go
use test
go
create table t1(col1 int)
create table t2(col1 int) on [primary]
create table t3(col1 int) on user_fg
select
object_name(i.id) as table_name,
groupname as [filegroup]
from sysfilegroups s, sysindexes i
where i.id in (object_id('t1'), object_id('t2'), object_id('t3'))
and i.indid < 2
and i.groupid = s.groupid
table_name filegroup
-- --
t1 PRIMARY
t2 PRIMARY
t3 user_fg
alter database test modify filegroup user_fg default
create table t4(col1 int)
select
object_name(i.id) as table_name,
groupname as [filegroup]
from sysfilegroups s, sysindexes i
where i.id in (object_id('t1'), object_id('t2'),
object_id('t3'),object_id('t4'))
and i.indid < 2
and i.groupid = s.groupid
table_name filegroup
-- --
t1 PRIMARY
t2 PRIMARY
t3 user_fg
drop database test
"CD" <mcdye1@.hotmail.REMOVETHIS.com> wrote in message
news:uC38SPPQFHA.3880@.tk2msftngp13.phx.gbl...
> I have a vendor product that has 15 filegroups and I would like to
determine
> what objects(tables,indx..) reside on what filegroup? I used generate
> script and looking at each object to see where it was created and this
seems
> the hard way to go about it. Is there a sp or a script that would list
the
> objects and where they exist with having to dig through these items.
> TIA
> C
>
No comments:
Post a Comment