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 2005 Forums
 SQL Server Administration (2005)
 How to get size of files in database

Author  Topic 

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-11-16 : 04:58:58
I want to get the file sizes for a database. I know I use SELECT * FROM sys.database_files, however, the file size in in 8KB pages.

How do I translate this into file size in KB or MB???

E.g. File has been allocated 1000MB, in sys.database_files, this value equals 128000?

Thanks

Hearty head pats

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-11-16 : 05:06:32
A page has 8192 bytes (8096 bytes data, 96 bytes header).
Btw. you can get fileinformation via sp_helpfile.



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-11-16 : 05:11:18
SELECT size/128. as size_in_mb,* FROM sys.database_files

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Bex
Aged Yak Warrior

580 Posts

Posted - 2009-11-16 : 05:15:34
Thank you both, especially for your prompt replies

have a good day!

Hearty head pats
Go to Top of Page
   

- Advertisement -