Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 xp_cmdShell and ping lists..

Author  Topic 

bill wooten
Starting Member

2 Posts

Posted - 2002-12-19 : 15:07:44
I want to create a stored procedure that is as clean as possible. I can get this to work with a cursor - but there should be a better way..

I want to go against an existing list of system names, do a ping, and store the results back. I would settle for being able to create a temp file that had the system name and result in it. An example of checking one system is as follows..


set nocount on
create table #output(data varchar(255))
declare @result int
declare @system_name varchar(20)

set @system_name = 'ping -n 1 systemnamehere'

insert #output
exec Master..xp_cmdShell @system_name
--select @@rowcount-1 --Get rid of the single NULL

select @result = count(data) from #output where data like '%reply%'

drop table #output


tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2002-12-19 : 15:16:48
You might want to consider doing this through vbscript instead.

Go to Top of Page

bill wooten
Starting Member

2 Posts

Posted - 2002-12-19 : 15:36:45
quote:

You might want to consider doing this through vbscript instead.

I am open to examples..



Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2002-12-19 : 16:00:24
This might help you out:

[url]http://cwashington.netreach.net/depo/view.asp?Index=714&ScriptType=vbscript[/url]

Go to Top of Page
   

- Advertisement -