Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / database / SQL-Server / SQL-Server-2008

Finding available free space in the disks of SQL Server

0.00/5 (No votes)
19 Mar 2012CPOL 8.6K  
Simple query to find the available hard disk space in the server

Introduction

As part of regular maintanence we needed to send a weekly report that included available harddisk space in our PROD SQL Server. This required a remote desktop login to the restrictive PROD environment and checking the space. We were unable to automate the status checks due to this particular item, after months of doing this as a manual activity found out that a simple procedure call will return the hard disk space from the Server machine.

Using the code

Just run the below procedure, no input parameters required!!

SQL
xp_fixeddrives

Output would be like this

SQL
drive MB free
----- -----------
C     31450
D     450047

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)