SQL Server Find the Size of Log File

Posted By on Sep 13, 2013 | 0 comments


I needed to obtain the size of a log file and found this article from SqlAuthority however I still needed something a little more useful.  So used the following tsql :

 

select size from sys.database_files where type_desc = 'LOG' and type = 1

 

If you’d like to convert this to megabytes you can use the following tsql :

 

select SUM(DATALENGTH(size)) / 1048576.0 Size_MBs from sys.database_files where type_desc = 'LOG' and type = 1

 

Feel free to view this Microsoft article which explains what the columns values are used for within sys.database_files.