<pre>
dump tran sybsystemprocs with truncate_only
go

use sybsystemprocs
go

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

create procedure sp_tablespace
as

-- Included in Sybase Tech notes Vol8, Num2 (2/8/99).  I combined
-- the two sp' s included to create this one all inclusive SP

drop table #temporary

select o.name, i.indid, reserved_pgs(i.id,doampg)
as "reserved_size", used_pgs(i.id,doampg,ioampg) as "used_size"
into #temporary
from sysindexes i, sysobjects o
where i.id = o.id and i.indid <= 1

insert #temporary
select o.name, i.indid, reserved_pgs(i.id,ioampg)
as "reserved_size", used_pgs(i.id,doampg,ioampg) as "used_size" 
from sysindexes i, sysobjects o
where i.id = o.id and i.indid > 1

select name, sum(reserved_size) *2 as "reserved size (kb)", 
sum(used_size) *2 as "used size (kb)"
from #temporary
group by name       

drop table #temporary  
go

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