Two quickest ways to find file information of a given database
This post was written by namwar on January 2, 2009
Posted Under: How-To, Query, SQL Server 2005, SQL Server 2008, System stored procedures, TSQL
Posted Under: How-To, Query, SQL Server 2005, SQL Server 2008, System stored procedures, TSQL
If you want to check the name of the files and their respective sizes for the given database then following are two quick tsql scripts:
1. Use sp_helpfile
This stored procedure returns the file information for the selected database e.g.
USE AdventureWorks;
GO
EXEC sp_helpfile;
GO
It will return the resultset similar to following
- sp_hellpfile result set
By default, this view returns a column called size but this is actually the size in 8KB pages therefore, to get the exact size in KB, as returned by sp_helpfile, multiply it by 8 as mentioned in above query.





Reader Comments
i can see the first way listed in the blog. what is the second way?