adminbd

Записи по mssql,oracle,windows и linux

Have a Question?

If you have any question you can ask below or enter what you are looking for!

Пинг компа из ssms

declare @cmnd  varchar(2000)
declare @ip varchar(15)
declare @res varchar(15)
 
set @ip = 's0049'   -- ip-адрес проверяемого узла
set @cmnd = 'ping -n 1 '+@ip
 
CREATE TABLE #tmp(s varchar(1000))
INSERT #tmp exec master.dbo.xp_cmdshell @cmnd
 
SET @res = (SELECT * FROM #tmp WHERE s LIKE '% потерь%' )
DROP TABLE #tmp
 
if (rtrim(ltrim(@res)) <> '(0% потерь)' or @res is null)
print 'Нет связи с компьютером'
else 
print @ip  +' '+ @res

 

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>