T-SQL Scripts to generate the HTML-formatted database storage report


This article explains the T-SQL scripts that can be used to manage and monitor the disk space on the database server. The T-SQL script contains queries to populate the following details.

List of drives, size of disk, and percentage available space Database files and their location. List of the database with other configuration parameters.

Moreover, we will create an HTML-formatted email that contains details of the above items.

Get a list of drives, size of disk, and percentage available space

We can use the xp_fixeddrives stored procedure to populate the details of the server’s disk drives. This procedure