The HTML webpage looks like the following image: Td = CONVERT(VARCHAR,CAST(CAST(available_bytes AS FLOAT)/ CAST(total_bytes AS FLOAT) AS DECIMAL(18,2)) * 100),' 'ĬROSS APPLY sys.dm_os_volume_stats(masterfiles.database_id, masterfiles.FILE_ID)volume FOR XML PATH('tr'), TYPE) AS NVARCHAR(MAX))+'' The HTML code to create a table with disk information is following: DECLARE nvarchar(max) ![]() You can read more about it in this article. In this article, we use sys.dm_os_volume_stats to populate the storage details on the server. Using this PowerShell will return the following information: The commands are the following: Get-WmiObject -Class win32_logicaldisk | Format-Table DeviceId, MediaType, Space" e= To populate the details, run the following query statement in SQL Server management studio or dbForge Studio for SQL Server: SELECT DISTINCTĬONVERT(Numeric(10,2),total_bytes/1048576/1024) AS ,Ĭonvert(Numeric(10,2),available_bytes/1048576/1024) AS ,ĬAST(CAST(available_bytes AS FLOAT)/ CAST(total_bytes AS FLOAT) AS DECIMAL(18,2)) * 100 AS ĬROSS APPLY sys.dm_os_volume_stats(database_id, file_id)Īlternatively, you can use Get-WmiObject or commandlet to populate the disk information of the local computer. We can also use a dynamic management function, named sys.dm_os_volume_stats, to populate the disk space. This procedure only provides the available space on the server for each drive. We can use the xp_fixeddrives stored procedure to populate the details of the server's disk drives. Get a list of drives, size of disk, and percentage available space Moreover, we will create an HTML-formatted email that contains details of the above items. List of the database with other configuration parameters. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |