February 12, 2009 at 3:31 pm
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!
February 12, 2009 at 5:20 pm
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
February 13, 2009 at 8:45 am
Thank you this works for me 😀
Create Table #Output
(
Output varchar(150) default('')
)
INSERT INTO #Output
EXECUTE xp_cmdshell 'ping 192.168.10.1'
SELECT *
FROM #Output
July 20, 2010 at 11:19 am
anvie (2/13/2009)
Thank you this works for me 😀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!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply