Skip to Content
0
Dec 06, 2019 at 03:53 PM

SQLAnywhere - report available drive space.

86 Views

Does anyone know about a function, procedure or other working SQL code snippet which would return the amount of free disk space available on the current drive? (I do not care about the DB or Log sizes, I need to know how much space is left of the host system.)

I found a procedure in Adaptive SE but that does not seem to work on SQLAny. I also tried to access Windows .dll library objects which in theory should work but in reality I am running into (I assume) permission issues and the desired values are not being returned.

Example:

CREATE FUNCTION diskInfo()  RETURNS varchar(100)  EXTERNAL NAME 'Unix:GetDiskFreeSpaceA@Kernel32.lib;GetDiskFreeSpaceA@Kernel32.dll';

select diskInfo();

Any help appreciated.