Tag Archives: Calculate Available DB Size

Script to calculate DB size and available size


SELECT Db_name()                                                           AS
       dbname,
       name                                                                AS
       filename,
       size / 128.0                                                        AS
       currentsizemb,
       size / 128.0  CAST(Fileproperty(name, ‘SpaceUsed’) AS INT) / 128.0 AS
       freespacemb
FROM   sys.database_files;