dump tran sybsystemprocs with truncate_only
go

use sybsystemprocs
go

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

create procedure tsp_whom @param char(12) = NULL
as

-- tsp_whom.sql: quick hack on sp_who to provide more useful info
-- Author: Todd Boss
-- Change log
-- date		author	purpose
-- 02/15/97	T.Boss	creation
-- 03/27/97	T.Boss	added grant select to public, modified to search
--			for itself and drop if exists
-- 04/01/97	T.Boss	modified to have custom user (m.kumar request)
-- 04/04/97	T.Boss	modified to be able to specify user or database
--			(jmckeeby request), changed param var name to @param

if (@param is NULL)
   select spid,physical_io,loginame=convert(char(12), suser_name(suid)),
      hostname,blk=convert(char(5),blocked),
      dbname=convert(char(10), db_name(dbid)),cmd
   from master..sysprocesses
else
   select distinct spid,physical_io,loginame=convert(char(12),
      suser_name(suid)), hostname,blk=convert(char(5),blocked),
      dbname=convert(char(10), db_name(dbid)),cmd
   from master..sysprocesses
   where convert(char(12), suser_name(suid)) like @param or
   convert(char(10), db_name(dbid)) like @param
   order by spid               
go

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