Gerrit Mantel
Programs SQL_SCALAR_FUNCTION - fun_DriveProperty_FreeSpace

Main program

Namefun_DriveProperty_FreeSpace
Type_descSQL_SCALAR_FUNCTION
CommentSQLServer User-Defined Function

PURPOSE
Return the free space in bytes of a given drive.

Return value (BIGINT):
-1 - Drive does not exist
Positive big integer - Free space in bytes

EXAMPLES
SELECT dbo.fun_DriveProperty_FreeSpace('C:')
76810420224

SELECT dbo.fun_DriveProperty_FreeSpace('B:')
-1

HISTORY
2000-01-01 - Created function
2014-11-20 - Changed @freespace type from varchar(20) to bigint
- Introduced sp_OADestroy @ofile
2024-02-09 - Changed history table

TAGS
<program>
<description>Return the free space in bytes of a given drive</description>
<generic>1</generic>
<author>Gerrit Mantel</author>a
<created>2000-01-01</created>
<lastmodified>2024-02-09</lastmodified>
</program>
DescriptionReturn the free space in bytes of a given drive
Minversion
Generic1
AuthorGerrit Mantel
Created2000-01-01 00:00:00
Lastmodified2024-02-09 00:00:00
Xp_cmdshell0
Ole_automation1
Subprogram_cnt0
Sourcecode