Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Save result ofa xp_cmdshell command Expand / Collapse
Author
Message
Posted Thursday, February 12, 2009 3:31 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 14, 2012 3:37 PM
Points: 34, Visits: 110
I need to check if my remote network is available every 5 mins. I am thinking to use ping.

Query:
exec master..xp_cmdshell 'ping 192.***.**.*'

Base on the output of this query I will know is my network is still available.

How can I save it in the table then determine from there the reply of the ping.

This practice seems not a good practice. Do I have other option?

Any comment is very appreciated.

Thanks!
Post #656169
Posted Thursday, February 12, 2009 5:20 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: 2 days ago @ 11:24 AM
Points: 32,781, Visits: 14,942
You can insert..exec into a table.

insert MyTable exec xp_cmdshell ''

but you need to match up the result set with the schema correctly







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #656233
Posted Friday, February 13, 2009 8:45 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, June 14, 2012 3:37 PM
Points: 34, Visits: 110
Thank you this works for me :D

Create Table #Output
(
Output varchar(150) default('')
)

INSERT INTO #Output
EXECUTE xp_cmdshell 'ping 192.168.10.1'


SELECT *
FROM #Output
Post #656693
Posted Tuesday, July 20, 2010 11:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, September 16, 2010 10:44 AM
Points: 2, Visits: 23
anvie (2/13/2009)
Thank you this works for me :D

Create Table #Output
(
Output varchar(150) default('')
)

INSERT INTO #Output
EXECUTE xp_cmdshell 'ping 192.168.10.1'


SELECT *
FROM #Output


Beautiful. That works well. Thanks!
Post #955777
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse