Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 filegroup the primary key

Author  Topic 

jpham
Starting Member

19 Posts

Posted - 2006-09-15 : 20:00:44
Hi All.
Is there a easy way to get the file group of the primary key of the table.
I have a table called TABLEA for example and there is the primary key PK_TABLEA is
created in the MSSQL database and I want to find out what the file group
this primary key PK_TABLEA is created on.
Your help is greatly appreciated.
Thanks,
JP

Luis Martin
Yak Posting Veteran

54 Posts

Posted - 2006-09-15 : 20:23:15
If I understand your question:
You can use QA or EM for that. With QA, Tools, Manage Index, your database, pick Pk, edit and you will find filegroup.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-17 : 02:16:18
You can also use undocumented sp_objectfilegroup procedure like this:

Declare @obj int
select @obj = Object_ID('TableA')
exec sp_objectfilegroup @obj


Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-09-17 : 02:22:05
or this:

select g.groupname
from sysindexes i
join
sysfilegroups g
on i.groupid = g.groupid
where i.name = 'PK_TableA'



Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -