SQL中取IP地址收藏.docVIP

  • 3
  • 0
  • 约2.16千字
  • 约 3页
  • 2017-08-05 发布于河南
  • 举报
SQL中取IP地址收藏 该方法查自网上,实际运用过程中,可根据实际情况修改 以下是根据SPID获取IPADDRESS create proc sp_get_hostip (@spid int = NULL) as set nocount on declare @host varchar(100) declare @ip varchar(15) declare @cmd varchar(200) declare @temp varchar(255) create table #ip(iptext varchar(255)) If @spid is null select @host = host_name() else select @host = max(hostname) from master..sysprocesses where spid = @spid if @host is not null begin set @cmd = ping -n 1 + @host insert #ip exec master..xp_cmdshell @cmd select @ip = ISNULL(substring(iptext,(charindex([,iptext)+1), (charindex(],iptext)-(charindex([,iptext)+1))),) from

文档评论(0)

1亿VIP精品文档

相关文档