﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server 2008 - General  / sql query to find in which datafile a particular table exists / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Fri, 24 May 2013 07:04:04 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: sql query to find in which datafile a particular table exists</title><link>http://www.sqlservercentral.com/Forums/Topic1409892-391-1.aspx</link><description>[code="sql"]SELECT 	o.[name] AS ObjectName, 	o.[type] AS ObjectType,	s.[name] AS SchemaName,	f.[name] AS [Filename],	i.[name] AS PrimaryKey, 	i.[index_id] AS IndexIDFROM 	sys.indexes iINNER JOIN 	sys.filegroups f	ON 	i.data_space_id = f.data_space_idINNER JOIN 	sys.all_objects o	ON 	i.[object_id] = o.[object_id]INNER JOIN 	sys.schemas s	ON 	s.[schema_id] = o.[schema_id]order by 	s.[name],	o.[name][/code]</description><pubDate>Tue, 22 Jan 2013 08:10:31 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: sql query to find in which datafile a particular table exists</title><link>http://www.sqlservercentral.com/Forums/Topic1409892-391-1.aspx</link><description>i have this saved, whcih shows all tables/the filegroup they belong to:[code]SELECT    objz.[name],    objz.[type],    idxz.[name],    idxz.[index_id],    CASE idxz.[index_id]     WHEN 0 THEN 'HEAP'     WHEN 1 THEN 'CLUSTERED'     ELSE 'NON-CLUSTERED'   END AS index_type,   filz.[name] FROM sys.indexes idxz INNER JOIN sys.filegroups filz ON idxz.data_space_id = filz.data_space_id INNER JOIN sys.all_objects objz ON idxz.[object_id] = objz.[object_id] WHERE idxz.data_space_id = filz.data_space_id AND objz.type_desc IN( 'USER_TABLE') -- User Created Tables[/code]</description><pubDate>Tue, 22 Jan 2013 08:10:19 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: sql query to find in which datafile a particular table exists</title><link>http://www.sqlservercentral.com/Forums/Topic1409892-391-1.aspx</link><description>Different file groups</description><pubDate>Tue, 22 Jan 2013 08:01:35 GMT</pubDate><dc:creator>rajkiran.panchagiri</dc:creator></item><item><title>RE: sql query to find in which datafile a particular table exists</title><link>http://www.sqlservercentral.com/Forums/Topic1409892-391-1.aspx</link><description>A table doesnt exist on a data file, it exists on a file group.Are the MDF and NDF in different file groups or are they both in the primary filegroup?</description><pubDate>Tue, 22 Jan 2013 04:06:55 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>sql query to find in which datafile a particular table exists</title><link>http://www.sqlservercentral.com/Forums/Topic1409892-391-1.aspx</link><description>Hi Friends, Let us assume am having 2 data files one mdf and one ndf. I have stopped the autogrowth of mdf. Is there a way to find in which data file the particular table exists.Thanks in advance.</description><pubDate>Tue, 22 Jan 2013 03:27:37 GMT</pubDate><dc:creator>rajkiran.panchagiri</dc:creator></item></channel></rss>