I am using this query. It gives me Total bytes and Free bytes in MB. I want to include free % in same query, But I am not able to do so. It is giving me either 0 or different values. Can anyone help here I am trying the commented part for free %. SELECT @@SERVERNAME as 'Servername', (((SUM(total_bytes))/1024)/1024)/1024 as 'Total_space(In MB)' , (((SUM(available_bytes))/1024)/1024)/1024 as 'Available_space (in MB)',/* ( ( (SUM(total_bytes)) / (SUM(available_bytes)) ) *100) as 'Free SPace in %' */FROM master.sys.master_files AS f CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id)where f.file_id=1 and f.database_id > 4 and Volume_mount_point like '%S%'
↧