Monday, January 25, 2010

Get Datatabase LOG Size


SELECT
(size * 8)/1024.0 AS size_in_mb,
CASE
WHEN CAST( max_size AS BIGINT )= -1 THEN 9999999 -- Unlimited growth, so handle this how you want
ELSE (CAST( max_size AS BIGINT ) * 8)/1024.0
END AS max_size_in_mb
FROM
sys.database_files
WHERE
data_space_id = 0 -- Log file

No comments: