Guest_imported
New member
- Jan 1, 1970
- 0
Running SQL Server 7.0 on Windows 2000 server.
I would like to create a step job that pings an IP address of a bridge to verify that it is on the network. When using CMDEXEC job type, the exit code is 0 both when the IP replies and when it does not. The job is always successful. I need it to fail when the ping does not get a reply. The following SQL will help to test because @result equals the exit code.
DECLARE @result int
EXEC @result = xp_cmdshell 'ping invalidip'
SELECT @result
@result will equal 1 if a name is used for the ip address that WINS or DNS can not resolve. I could use a complicated batch file, but if anyone hase anything better, it would be greatly appreciated.
I would like to create a step job that pings an IP address of a bridge to verify that it is on the network. When using CMDEXEC job type, the exit code is 0 both when the IP replies and when it does not. The job is always successful. I need it to fail when the ping does not get a reply. The following SQL will help to test because @result equals the exit code.
DECLARE @result int
EXEC @result = xp_cmdshell 'ping invalidip'
SELECT @result
@result will equal 1 if a name is used for the ip address that WINS or DNS can not resolve. I could use a complicated batch file, but if anyone hase anything better, it would be greatly appreciated.