Skip to content

Error in qpi.volumes #8

@schneiderb

Description

@schneiderb

Hi there,

just realized there is a small errror in the view qpi.volumes, used_gb should be total_gb and total_gb should be used_gb while substracting available_bytes from total_bytes.

CREATE VIEW qpi.volumes
AS
SELECT volume_mount_point,
total_gb = CAST(MIN(total_bytes / 1024. / 1024 / 1024) AS NUMERIC(10,1)),
available_gb = CAST(MIN(available_bytes / 1024. / 1024 / 1024) AS NUMERIC(10,1)),
used_gb = CAST(MIN((total_bytes-available_bytes) / 1024. / 1024 / 1024) AS NUMERIC(10,1))
FROM sys.master_files AS f
CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id)
GROUP BY volume_mount_point;
GO

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions