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 2008 Forums
 SQL Server Administration (2008)
 query to find which data files indexes are using?

Author  Topic 

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2012-05-12 : 00:24:36
Currently I have to go through one by one and look at the storage properties. Is there a query that will list all the indexes and which data file they are using?

influent
Constraint Violating Yak Guru

367 Posts

Posted - 2012-05-16 : 20:11:11
select 'table_name'=object_name(i.id) ,i.indid
,'index_name'=i.name ,i.groupid
,'filegroup'=f.name ,'file_name'=d.physical_name
,'dataspace'=s.name from sys.sysindexes i
,sys.filegroups f ,sys.database_files d
,sys.data_spaces s
where f.data_space_id = i.groupid
and f.data_space_id = d.data_space_id
and f.data_space_id = s.data_space_id
Go to Top of Page

ferrethouse
Constraint Violating Yak Guru

352 Posts

Posted - 2012-05-21 : 11:29:29
Thank you. That is perfect.
Go to Top of Page
   

- Advertisement -