Saturday 6 October 2012

Database File Size and Free Space



USE [Database Name];

SELECT [name] AS [File Name]
      ,[physical_name] AS [Physical Name]
      ,[size]/128 AS [Total Size in MB]
      ,[size]/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS [Available Space In MB]
FROM sys.database_files;

No comments:

Post a Comment

Note: only a member of this blog may post a comment.