Welcome to SqlServer-QA.net Sign in | Join | Help

SQL Server Storage Engine & Tools (SSQA.net)

SQL Server Tools includes storage engine that includes a complete set of graphical tools and command prompt utilities that allow users, programmers, and administrators. SSMS, SSRS, SSIS & SSAS are most commonly used tools.
SQL 2005 TSQL Script to list tables, indexes, file groups along with file names

Here is the script I have used to list the information regarding database objects such as tables, indexes and file groups along with their file names :

 

 (extracted from Technet)

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 objectproperty(i.id,'IsUserTable') = 1
and f.data_space_id = i.groupid
and f.data_space_id = d.data_space_id
and f.data_space_id = s.data_space_id
order by f.name,object_name(i.id),groupid
go

 This works against SQL 2005 instance.

 

Posted: Monday, June 25, 2007 5:39 AM by SQL Master

Comments

SSQA - SqlServer-QA.net said:

Here is the script I have used to list the information regarding database objects such as tables, indexes

# June 25, 2007 5:44 AM
Anonymous comments are disabled