I have a Microsoft SQL Server 2017 Express Edition those have a size limit of 10240MB (10Gigs) and I am not sure how I can check how much space I have left in this license. I have tried the following:
SELECT DB_NAME(database_id) AS database_name,
type_desc,
name AS FileName,
size/128.0 AS CurrentSizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'DemoDB' AND type IN (0,1);
This outputs the following:
database_name | type_desc | FileName | CurrentSizeMB |
---|---|---|---|
DemoDB | ROWS | DemoDB | 10229.687500 |
DemoDB | LOG | DemoDB_log | 8217.000000 |
Is it the upper value CurrentSizeMB
10229.687500
or do I need to use another query?
size
, per the documentation, is the "Current file size, in 8-KB pages.", sosize/128.0
would be the current size of the data file in question in MiB.