通过sys.sysprocesses查询线程来源
SELECT hostname,loginame,* FROM sys.sysprocesses; SELECT count(*),hostname FROM sys.sysprocesses where cmd='AWAITING COMMAND' group by hostname; SELECT count(*),hostname,loginame FROM sys.sysprocesses where cmd='AWAITING COMMAND' group by hostname,loginame; SELECT hostname,loginame,* FROM sys.sysprocesses; DBCC INPUTBUFFER(@@spid)