
declare @s varchar(1000)
set @s='ping '+host_name()+' -a -n 1 -l 1'
insert #ip(re) exec master..xp_cmdshell @s
select 连接的计算机名=host_name(),RE
IP地址=stuff(left(re,charindex(']',re)-1),1,charindex('[',re),'')
from #ip
where id=2
drop table #ip
服务器地址可以是:localhost 、127.0.0.1、服务器ip地址;
默认填写localhost
数据库地址就是要调用的数据库的服务器ip
服务器和站点在相同服务器上可以使用第一点说的三种方式
服务器和站点不在相同ip上就需要输入数据库的外网ip地址。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)