|
|
In order to programmatically determine Free Hard Disk Space using T-SQL, use the extended stored procedure master.dbo.xp_fixeddrives which returns a list of all hard drives and the free space(in MB) for each of the hard drive.
DECLARE @OSDriveSpace TABLE
(
DriveNm char(1),
FreeDriveSpaceInMB int
)
INSERT INTO @OSDriveSpace
EXEC master.dbo.xp_fixeddrives
SELECT * FROM @OSDriveSpace
Note: The T-SQL query shown above does not take into account Volume Mount Points. If you need to include mount points and monitor them, then make sure you check out this article CLR stored procedure to get disk space information which shows how to use a CLR stored procedure to return the capacity and free space of a mount point.
OUTPUT
Did you like this post?
|
|
|
||
|
|
|
|
|
|
|
subscribe via rss |
|
subscribe via e-mail |
|
|
print this post |
|
follow me on twitter |






comments
0 Responses to "Get Free Disk space using SQL Server"Post a Comment