Friday, January 29, 2010

Check available disk space in all the database files

Here is the script:

use [db_name]
go

select name, size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') as int)/128.0 as AvailableSpaceInMB
from sys.database_files
go

Knowing this info is a good guide for file shrinking operations.

No comments:

Post a Comment