Tuesday, October 16, 2012

Space available on disk


select de.name, 'Size (meg)' = (high-low+1)/512, 'Used' =  sum(u.size)/256,
        'Available (meg)'=  (high-low+1)/512 -  sum(u.size)/256
from sysdatabases da, sysusages u, sysdevices de
where da.dbid = u.dbid and u.vdevno = de.vdevno
and cntrltype = 0
group by de.name

Sometimes, I simply post these things here for my own convenience...