Thursday, June 5, 2014

To Check whether Given IP Address is 'Pinging'

-- To Check To Check whether Given IP Address is 'Pinging'


drop table #TempTable
declare @IP as varchar(15)
declare @cmd as varchar(300)
set @IP = '192.168.50.200'  -- fill the ip address here
set @cmd = 'ping ' + @IP
--Create table
create table #TempTable (output varchar(150) default(''))
insert into #TempTable
exec xp_cmdshell @cmd

select * from #TempTable where output is not null


No comments:

Post a Comment