<pre>
dump tran sybsystemprocs with truncate_only
go

use sybsystemprocs
go

if exists (select * from sysobjects where name = "sp_devspace" and type = 'P')
   drop proc sp_devspace
go

create procedure sp_devspace as 

-- Posted to c.d.s. by Ty Moser <tmoser@iquest.net> 8/11/97

--the total device space in use

select  "Device Name"   = convert(char(15), dev.name)
  ,"Total (MB)"   = (((high - low) + 1) / 512)
  ,"Used (MB)"    = sum(isnull(size, 0)) / 512
  ,"Unused (MB)"  = (((high - low) + 1) / 512) - sum(isnull(size, 0)) / 512
        ,"# Fragments"  = count(vstart)
from master..sysusages usage, master..sysdevices dev
where low/16777216 *= vstart/16777216 and dev.status <> 16
group by dev.name,((high - low) + 1) / 512
order by dev.name    

go

if object_id('sp_devspace') is not null
begin
    print '<<< Created procedure dbo.sp_devspace >>>'
    grant execute on dbo.sp_devspace to public
end
else
begin
    print '<<< Failed creating proc dbo.sp_devspace >>>'
end
go         
