CODE: Ping update

USE [Leads]

GO
SET ANSI_NULLSON
GO
SET QUOTED_IDENTIFIERON
GO

CREATE PROCEDURE [dbo].[sp_PingBLSWebsites]

AS

DECLARE @counter int
DECLARE @result VARCHAR(15)
DECLARE @ip varchar(15)
DECLARE @web varchar(100)
DECLARE @webs varchar(100)

set @counter = 0

— ping all the IP’s

WHILE @counter <(SELECT COUNT(*)AS blscount FROM dbo.keywords_domains where URLip isnull)

BEGIN

SELECT top 1 @web=replace([url],’http://’,”),@webs=replace([url],’http://’,”)
FROM keywords_domains
WHERE (URLip ISNULL)

exec sp_get_ip_address @web, @ip out

UPDATE keywords_domains
SET URLip=rtrim(@ip)
WHERE [url]like @webs

END

set @counter=@counter+1