create table #table(spid int ,ecid int,status varchar(1000)....)
insert into #table(spid,ecid,status.....) exec sp_who 
select count(*) from #table可以得到hostName
declare @cmdStr varchar(100)
drop table #table
create table #table(id int identity,txt varchar(1000))
select @cmdStr='ping '+@@hostName
insert into #table(txt) exec master..xp_cmdshell @cmdStrselect substring(txt,charindex('[',txt)+1,charindex(']',txt)-charindex('[',txt)-1) from #table where id=2
--得到IP地址,也可以不直接用hostName
declare @sendstr varchar(100)
select @sendstr='net send '+@HostName+'Messages!'
exec master..xp @sendstr

解决方案 »

  1.   

    展开服务器组,然后展开服务器。
    展开"管理",然后展开"当前活动"。
    单击"进程信息"。 
    服务器的当前活动即会显示在详细信息窗格中。在详细信息窗格中,右击一个进程 ID,然后单击"发送消息"命令。 
    说明  当 SQL Server 企业管理器在 Microsoft® Windows® 98 上运行时,不可能向用户发送消息。在"消息"框中键入消息。
    另外,可选择"使用主机名",然后输入计算机名以便将消息发送到指定的计算机。