Wednesday, July 11, 2007

We have ways of making you talk...

Want to know your remote SQL server's IP addres, without all the NAT that's in between you two?



create table #ipconfig (results varchar(250) null)

insert into #ipconfig
exec xp_cmdshell 'ipconfig'

SELECT REPLACE(SUBSTRING(results,CHARINDEX(':',results,1)+1,LEN(results)),' ','')
from #ipconfig
where results like '%IP Address%'


Outputs the IP address of the server, locally.

No comments: