Querying System Table for Space Usage Information

You may want to write some of your own queries to get information about physical storage.

For example, to determine the total number of 2K blocks of storage space that exist on SAP ASE, query sysdevices:
select sum(convert(numeric(20,0), high - low + 1))
from sysdevices 
where status & 2 = 2
----------------- 
             230224

In this example, the 2 for the status column (line 3) indicates a physical device. high is the highest valid 2KB block on the device, so you must add 1 to get the true count from the subtraction (high – low in the first line) and convert counts to numeric(20,0) to avoid overflow from integer addition in the sum.