Is there a ‘nice’ way to check whether an network host is up
making use of ‘plain’ SQL? I thought of some MS-SQL specific
command or maybe some getting the return value from a ping script
on the server itself.
Does anyone has an idea on this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s two possible ways to take your answer:
1. you want to know if a SQL server is running on an arbitrary host
2. You want to ping an arbitrary host from a SQL server using some query.
you could use dariom’s answer.
1a. if you want to query one SQL server from another, you’re better off using the “Linked Servers” functionality of SQL Server.
You can use the master.dbo.xp_cmdshell stored procedure to execute PING, which then returns the results as text rows and a status code.
EXEC master.dbo.xp_cmdshell ‘ping 192.168.1.1’