August 5, 2010 at 11:53 am
Hello Everyone
I am looking for the table that stores the database size. For the life of me I cannot recall the name.
Thanks
Andrew SQLDBA
August 5, 2010 at 12:29 pm
Is this what you're looking for? I like to see the space in MB, thus the first computed field.
select (size *8)/1024 as MB, * from <dbname>.sys.database_files
Cindy
August 5, 2010 at 12:37 pm
That is it, for the one database.
I was looking for the table that stored the size for each database on the particular box.
Unless I am mistaken, and I had to write some code to go out and capture the size from each and place that data into a central table. I did this a long while back, and now I cannot remember what I did. The SSIS package that I had created is located at another company.
Thanks for your help
Andrew SQLDBA
August 5, 2010 at 12:43 pm
One option might be to use the sp_msforeachdb stored proc.
For exmaple:
EXEC sp_msforeachdb 'SELECT (size *8)/1024 as MB, * from ?.sys.database_files'
I also found this after doing a search:
http://www.siusic.com/wphchen/t-sql-query-to-get-database-size-325.html
August 5, 2010 at 12:44 pm
Check out this post. I modified the code extensively to fit my custom requirements, but it's a great starting point.
http://www.sqlservercentral.com/Forums/Topic869519-2627-1.aspx
Cindy
August 5, 2010 at 12:44 pm
Are you thinking of sys.master_files?
- Jeff
August 5, 2010 at 12:48 pm
Ahhh Haaa
That is it!! Thank You.
I was going crazy trying to find that.
Andrew SQLDBA
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply