I was curious about, is there any way to get the size of all drives of a server using sql query. I found one as follows.
EXEC master..xp_fixeddrives
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