Free Information Technology Magazines and eBooks

Sunday, June 28, 2009

How to get free disk space Using T-SQL

When working with limited disk space database server like my test server at home, I make sure to check the machine's disk space now and then. To get the free disk space for all physical drives on a machine using T-SQL, we can make use of the undocumented extended stored procedure called xp_fixeddrives.

Here is a sample T-SQL code to call xp_fixeddrives:


USE master
EXEC xp_fixeddrives


If executed, the code above will produce a list that contains the driver letter and its available disk space.

For more T-SQL coding tips, subscribe now.

0 comments: