top of page

Find Available space and Size of your SQL Server Data and Log Files

-- **** Switch to a user database *****

USE YourDatabaseName;

GO


-- Individual File Sizes and space available for current database

SELECT name AS [File Name] , physical_name AS [Physical Name], size/128000.0 AS [Total Size in GB],

size/128000.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128000.0 AS [Available Space In GB], [file_id]

FROM sys.database_files WITH (NOLOCK) OPTION (RECOMPILE);


-- Look at how large and how full the files are and where they are located

-- Make sure the transaction log is not full!!

13 views0 comments

Comments


bottom of page