How much free space is available from T-SQL

  • Often, before doing large operations, I need to find the free disk space.
  • Microsoft SQL Server provides xp_fixeddrives to display the list of all the hard drives and their free space.

Applies to:

  • Microsoft SQL Server 2000
  • Microsoft SQL Server 2005

Free space

  1. EXEC xp_fixeddrives;
  2. go
drive MB free
----- -----------
C     2694
  • xp_fixeddrives will list all the drives.
  • xp_fixeddrives will return not the size of the drives, but the free space in megabytes/MB.
  • xp_fixeddrives is not documented in the books-on-line, therefore is not supported by Microsoft. I hope that it will still be available in Microsoft SQL Server 2008.