﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / T-SQL (SS2K5)  / Need a Stored procedure / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 19:38:59 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>If I had to pick a poison I would implement a SQLCLR method (of my own) before I would use xp_cmdshell for this. That said, at the end of the day none of it belongs in T-SQL.Rolling your own SQLCLR objects to confirm a ping was possible or get the ping round trip time would be trivial. The SQL# methods are thin wrappers over methods on the .NET Ping class built into .NET 2.0.[u][url=http://msdn.microsoft.com/en-US/library/ms144956(v=vs.80).aspx]Ping.Send Method (String, Int32, Byte[], PingOptions)[/url][/u]</description><pubDate>Wed, 23 Jan 2013 08:07:59 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>Another option is the paid version of the SQL# CLR library by Solomon Rutzky: [url]http://www.sqlsharp.com/[/url]There are two functions in it: INET_Ping and INET_PingTime that may be of interest to you.As I said though, they're not available in the free version of the library (unfortunately).</description><pubDate>Mon, 21 Jan 2013 18:02:42 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>I do not condone using xp_cmdshell at all, and especially not for something like this, but if you must here is someone who has detailed the technique from beginning to end:[u][url=http://www.sqlmag.com/content1/topic/ssis-package-pings-servers-143994/catpath/sql-server]http://www.sqlmag.com/content1/topic/ssis-package-pings-servers-143994/catpath/sql-server[/url][/u]</description><pubDate>Mon, 14 Jan 2013 15:53:25 GMT</pubDate><dc:creator>opc.three</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>i agree with Sean, however, this bit of SQL will do what you ask the reults are not that cracking though.[code="sql"]create proc ping_test (@host varchar(100))as begindeclare 		@exec varchar(1000)		set @exec='EXECUTE master..xp_cmdshell '+''''+'ping '+@host+''''exec  (@exec)end[/code]</description><pubDate>Mon, 14 Jan 2013 14:15:22 GMT</pubDate><dc:creator>SGT_squeequal</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>Storing the results in sql is fine but the process you are describing is an application. Yes you can probably find a way to make this work but that doesn't mean it is a good idea. To paraphrase Joe Celko, "don't drive a screw in a piece of fine furniture by pounding it in with a rock".</description><pubDate>Mon, 14 Jan 2013 14:12:08 GMT</pubDate><dc:creator>Sean Lange</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>We want to do it in sql and store the average of each ping in a table along with the host name and times tamp.</description><pubDate>Mon, 14 Jan 2013 13:50:57 GMT</pubDate><dc:creator>oradbguru</dc:creator></item><item><title>RE: Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>do you really need to do this with SQL? what is the purpose of the ping? are you just checking to see if a server is pingable? perhaps a vbs script would be better?</description><pubDate>Mon, 14 Jan 2013 13:48:32 GMT</pubDate><dc:creator>SGT_squeequal</dc:creator></item><item><title>Need a Stored procedure</title><link>http://www.sqlservercentral.com/Forums/Topic1406932-338-1.aspx</link><description>Hello, I need help writing a stored procedure that will take a parameter in as @hostName VARCHAR(100) and using xp_cmdshell, ping the server specified as @hostName.  Any examples would be greatly appreciated.</description><pubDate>Mon, 14 Jan 2013 13:35:49 GMT</pubDate><dc:creator>oradbguru</dc:creator></item></channel></rss>