Sunday, February 19, 2012

How to know a Server IP address?

Hi
I read that with the next instruction in the SQL Query Analyzer I can know
the IP address of my actual server:
exec master..xp_cmdshell 'ipconfig'
However, it shows 9 rows with additional information I don't want.
I just want the IP address.
How can I do this?
Thanks
Gonzalo,
PING? but will return 3 rows as well. Possibly xp_regread (undoc in Master
db) to read key containing IP address?
HTH
Jerry
"Gonzalo Torres" <condormix2001@.yahoo.com.mx> wrote in message
news:u1eJ0p10FHA.3924@.TK2MSFTNGP14.phx.gbl...
> Hi
> I read that with the next instruction in the SQL Query Analyzer I can know
> the IP address of my actual server:
> exec master..xp_cmdshell 'ipconfig'
> However, it shows 9 rows with additional information I don't want.
> I just want the IP address.
> How can I do this?
> Thanks
>
|||Gonzalo Torres wrote:
> Hi
> I read that with the next instruction in the SQL Query Analyzer I can
> know the IP address of my actual server:
> exec master..xp_cmdshell 'ipconfig'
> However, it shows 9 rows with additional information I don't want.
> I just want the IP address.
> How can I do this?
> Thanks
Insert the output from xp_cmdshell into a temp table and parse it as
needed. Run IPCONFIG from the command prompt with the "/?" parameter for
a list of options that may help you reduce its output.
David Gugick
Quest Software
www.imceda.com
www.quest.com

No comments:

Post a Comment