hi,
how can i see all tables/indexes in a specfic filegroups...
ive 3 filegroups..want to check all tables belonging to one filegroups..or al..
thnksSanjay,
Query to see which tables are placed on which filegroup is:
select distinct (select groupname from sysfilegroups where groupid = a.groupid) as filegroup,
object_name(id) as 'object name' from sysindexes a
where groupid <> 0
--undocumented stored procedure
sp_objectfilegroup @.objid
--
- Vishal
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:85246813-F9AF-438A-9AB5-FAC13AA5E676@.microsoft.com...
> hi,
> how can i see all tables/indexes in a specfic filegroups...
> ive 3 filegroups..want to check all tables belonging to one filegroups..or al..
> thnks
>|||Something like this?
SELECT o.name, f.name
FROM
sysobjects o
inner join
sysindexes i
on o.id = i.id
inner join
sysfiles f
on f.groupid = i.groupid
Note that it will show many tables spread across multiple filegroups, unless
you explicitly specified a filegroup in the create table or create clustered
index statements.
A
"sanjay" <anonymous@.discussions.microsoft.com> wrote in message
news:85246813-F9AF-438A-9AB5-FAC13AA5E676@.microsoft.com...
> hi,
> how can i see all tables/indexes in a specfic filegroups...
> ive 3 filegroups..want to check all tables belonging to one filegroups..or
al..
> thnks
>|||Sorry, this gets the files, not the filegroups. For filegroups:
SELECT DISTINCT o.name, g.groupname
FROM
sysobjects o
inner join
sysindexes i
on o.id = i.id
inner join
sysfilegroups g
on g.groupid = i.groupid
"Aaron Bertrand - MVP" <aaron@.TRASHaspfaq.com> wrote in message
news:egqYkHTpDHA.2676@.TK2MSFTNGP11.phx.gbl...
> Something like this?
> SELECT o.name, f.name
> FROM
> sysobjects o
> inner join
> sysindexes i
> on o.id = i.id
> inner join
> sysfiles f
> on f.groupid = i.groupid
> Note that it will show many tables spread across multiple filegroups,
unless
> you explicitly specified a filegroup in the create table or create
clustered
> index statements.
> A
>
> "sanjay" <anonymous@.discussions.microsoft.com> wrote in message
> news:85246813-F9AF-438A-9AB5-FAC13AA5E676@.microsoft.com...
> > hi,
> > how can i see all tables/indexes in a specfic filegroups...
> > ive 3 filegroups..want to check all tables belonging to one
filegroups..or
> al..
> > thnks
> >
>
No comments:
Post a Comment