sql server find the size of database file find the size of log file

Today I got a concern from my colleague, how to find the size of database file using sql query. Here is query, you can alter this query according to your need.

SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = ‘master’
GO

Share this:
Share

Leave a Reply

Your email address will not be published. Required fields are marked *