用什么sql语句可以得到本地的ip啊?
------解决方案--------------------
declare @computerName varchar(20),@ip varchar(20)
set @computerName=host_name()
create table ##(str varchar(100))
exec( 'insert ## exec master..xp_cmdshell ' 'ping '[email protected]+ ' ' ' ')
select @ip=stuff(str,1,charindex( '[ ',str), ' ')
from ##
where ltrim(str) like 'Pinging% '
select left(@ip,charindex( '] ',@ip)-1)
drop table ##