<pre>
dump tran sybsystemprocs with truncate_only
go

use sybsystemprocs
go 

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

create proc sp_freeall
as

-- Summarizes nicely free space allocation in all databases in a server
-- Author: ?
-- 10/5/98 Posted to Sybase-L by Michael Heaney mheaney@tigr.org

begin
        set nocount on

        select "Free Space For: " + @@servername
        print ""
        print ""

        select  size = sum(size),
                free = sum(curunreservedpgs(dbid,lstart,unreservedpgs)),
                segmap,
                dbid
        into #free1
        from master..sysusages
        group by dbid, segmap

        print "*** Total Free Data Space ***"

        select  size = sum(size),
                free = sum(free),
                dbid
        into #free2
        from #free1              
        where segmap & 3 = 3
        group by dbid

        select  DB_Name = substring(db_name(dbid), 1,20),
                Free_KBytes=free*2,
                Total_KBytes=size*2,
                Used_KBytes=(size-free) * 2,
                Percent_Free = str(convert(float,free)/size * 100.0,6,2)
        from #free2
        order by db_name(dbid)

        print ""
        print ""
        print "*** Total Free Log Space ***"

        select  size = sum(size),
                free = sum(free),
                dbid
        into #free3
        from #free1
        where segmap & 4 = 4
        group by dbid      

        select  DB_Name = substring(db_name(dbid), 1,20),
                Free_KBytes=free*2,
                Total_KBytes=size*2,
                Used_KBytes=(size-free) * 2,
                Percent_Free = str(convert(float,free)/size * 100.0,6,2)
        from #free3
        order by db_name(dbid)

        print ""
        print ""
        print "*** Total Combined Free Space ***"

        select  size = sum(size),
                free = sum(free),
                dbid
        into #free4
        from #free1
        where segmap & 7 = 7
        group by dbid

        select  DB_Name = substring(db_name(dbid), 1,20),
                Free_KBytes=free*2,
                Total_KBytes=size*2,
                Used_KBytes=(size-free) * 2,
                Percent_Free = str(convert(float,free)/size * 100.0,6,2)
        from #free4
        where size > 0
        order by db_name(dbid)
end
go

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