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:
Post a Comment