473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Finding the filegroups associatted with a table in T-SQL

Hi,

I want to find out in my SP the filegroup associated with a particular
table? I was not able to establish the relationship between sysobjects
and sysfilegroups table. Is there any other way to find filegroup of a
table in T_SQL?
Also lets say there are 3 dtatfiles in a filegroup 'FG1' and table
'xyz' is created on filegroup 'FG1' - Is there any way to find out the
datafile's names on which table xyz's data is scattered?

Thanks in Advance,

Subodh
Jul 20 '05 #1
1 7940
"Subodh" <sg****@triversity.com> wrote in message
news:a4*************************@posting.google.co m...
Hi,

I want to find out in my SP the filegroup associated with a particular
table? I was not able to establish the relationship between sysobjects
and sysfilegroups table. Is there any other way to find filegroup of a
table in T_SQL?
Also lets say there are 3 dtatfiles in a filegroup 'FG1' and table
'xyz' is created on filegroup 'FG1' - Is there any way to find out the
datafile's names on which table xyz's data is scattered?

Thanks in Advance,

Subodh


For the first part of your question, unfortunately there is no supported
function to return this information. The only documented way to find the
filegroup is with sp_help, or by using the .FileGroup property of the table
object via SQL-DMO. However, sp_help calls an undocumented procedure called
sp_objectfilegroup to get the information - you could re-use the code from
that procedure in your own code (it joins sysindexes on sysfilegroups, which
works even for tables with no idexes).

As for the second part of your question, SQL Server always spreads data
across all files in a filegroup - see the topic "Using Files and Filegroups"
in BOL.

Simon
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dan Muey | last post by:
Howdy List! A couple questions about finding the disk space used by a = table/database: 1) First how can I get the size a table is taking up on disk? Is it the 'Data_length' field in: SHOW...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
3
by: Helgardh | last post by:
I have a linked table (Access 2003) to an Outlook inbox. The body of the e-mail messages are in a memo field. My problem is that I need to "read" the memo and find data on certain lines. The...
2
by: Bob | last post by:
I have been looking at the code for MedianFind(pDte As String) from the following thread from UtterAccess.com: "Finding Median average grouped by field" I have been able to get it to run using...
9
by: Laurent Bugnion | last post by:
Hi, I am wondering what is the best way to find out which ASP.NET sessions are still active. Here is the reason: I have a custom control which can upload files. It saves the files in a folder...
2
by: ElkGroveR | last post by:
Hi there! I'm using PHP to create a simple, dynamic MySQL SELECT query. The user chooses a selection from a HTML Form SELECT element's many options and submits the form via a POST action. ...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
4
lucas911
by: lucas911 | last post by:
I'm sure that this is possible: I have a parent directory that has sub directories. Each sub directory will store certain files in certain formats, i.e. i have 1 directory for excel, 1 for...
1
ebs57
by: ebs57 | last post by:
This one is a bit tough (for me). I'm running a query that looks through two unrelated tables: One table contains an ID and the name of a training document while the other table contains an ID, an...
7
by: stevewy | last post by:
I'm looking to manipulate/check the state of various checkboxes and radios in a form. Because I don't want to access all of the checkboxes in the form, only a specific section, I am trying to...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.