您现在的位置: 中国男护士网 >> 考试频道 >> 计算机等级 >> 一级辅导 >> 正文    
  根据进程号获取该进程所在客户端的ip地址 【注册男护士专用博客】          

根据进程号获取该进程所在客户端的ip地址

www.nanhushi.com     佚名   不详 

create procedure dbo.sp_spidtoip @spid int
as
-- spid to mac
-- lj
declare @mac as varchar(12)
select @mac = net_address from master..sysprocesses where spid = @spid
-- mac to ip
declare @macdisplay as varchar(18)
declare @ip as varchar(15)
create table #temp (output varchar(255) null)
set nocount on
insert into #temp exec master..xp_cmdshell 'arp -a'
if @@error<>0
begin
raiserror ('the level for job_id:%d should be between %d and %d.', 16, 1)
--rollback transaction
end
select @macdisplay = left(@mac, 2) + '-' + substring(@mac, 3, 2) + '-' + substring(@mac, 5, 2) + '-' + substring(@mac, 7, 2) + '-' + substring(@mac, 9, 2) + '-' + substring(@mac, 11, 2) select @ip = substring(output, 3, 15) from #temp where output like '%' + @macdisplay + '%'
-- resolve the ip
--declare @cmd as varchar(100)
--select @cmd = 'master..xp_cmdshell "ping -a ' + @ip + '"'
--exec (@cmd)
drop table #temp
set nocount off
go

 

文章录入:杜斌    责任编辑:杜斌 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
     

    联 系 信 息
    QQ:88236621
    电话:15853773350
    E-Mail:malenurse@163.com
    免费发布招聘信息
    做中国最专业男护士门户网站
    最 新 热 门
    最 新 推 荐
    相 关 文 章
    2011年护士资格考试:考…
    2009年初级护士资格考试…
    2009年主管护师考试于12…
    2009年初级护士考试于12…
    2009年初级护师考试于12…
    石家庄市关于2009年度护…
    2009年护士专业技术资格…
    医护技能考试周末举行 4…
    护士“托福”今年7月开考
    护士“托福”考试开始报…
    专 题 栏 目