SELECT  spid SPID,
        sp.[status] Status,
        loginame [Login],
        hostname HostName,
        blocked BlockedBy,
        sd.name DatabaseName,
        cmd Command,
        cpu CPUTime,
        physical_io DiskIO,
        last_batch LastBatch,
        [program_name] ProgramName
FROM master.dbo.sysprocesses sp
	JOIN master.dbo.sysdatabases sd ON sp.dbid = sd.dbid
WHERE
	sd.name = @sourceDbName
ORDER BY spid

SELECT  spid SPID,
        RTRIM(sp.[status]) Status,
        RTRIM(loginame) [Login],
        RTRIM(hostname) HostName,
        RTRIM(blocked) BlockedBy,
        RTRIM(sd.name) DatabaseName,
        RTRIM(cmd) Command,
        cpu CPUTime,
        physical_io DiskIO,
        RTRIM(last_batch) LastBatch,
        RTRIM([program_name]) ProgramName
FROM master.dbo.sysprocesses sp
	JOIN master.dbo.sysdatabases sd ON sp.dbid = sd.dbid
WHERE
	sd.name = @sourceDbName
ORDER BY spid

Trim output from sysprocesses since they're not variable length...variables. yea.
Trim output from sysprocesses since they're not variable length...variables.  yea.
