/ Published in: SQL

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
DECLARE @DBNm VARCHAR(50) SET @DBNm = 'CPDB_%' SELECT d.name AS DBNm ,p.hostname ,CONVERT(sysname, rtrim(p.loginame)) AS loginname ,p.program_name , SUBSTRING(CONVERT(VARCHAR,p.last_batch,111) ,6 ,5 ) + ' ' + SUBSTRING(CONVERT(VARCHAR,p.last_batch,113) ,13 ,8 ) AS 'last_batch_char' ,p.blocked ,p.spid ,p.waittime ,p.waittype ,ctrl.dbo.fnWaitType(p.waittype, 'Dsc') AS WaitTypeDsc ,p.cmd ,p.status -- ,p.sid -- ,p.cpu -- ,p.physical_io -- ,p.dbid -- ,* FROM Master.dbo.sysProcesses p (nolock) LEFT JOIN Master.dbo.sysDatabases d ON d.DBId = p.DBId WHERE d.Name LIKE @DBNm ORDER BY d.name
Comments
