开发者

call tracert and ping from sql and put the result in sql table

开发者 https://www.devze.com 2022-12-13 08:23 出处:网络
I need to create a stored procedure which will get desti开发者_运维知识库nation IP and then call tracert or ping and then write the result into a sql table so then I can show user the result in a web

I need to create a stored procedure which will get desti开发者_运维知识库nation IP and then call tracert or ping and then write the result into a sql table so then I can show user the result in a web page . is it possible to do this ? if yes would you please tell me how because I have searched a lot and didn't find a proper solution . and if not what do you suggest ?

Thanks


Modify as needed -

declare @results table(result varchar(500))

insert into @results
exec sp_executesql N'xp_cmdshell ''ping www.yahoo.com'''

select * from @results

Similarly for tracert

declare @results table(result varchar(500))

insert into @results
exec sp_executesql N'xp_cmdshell ''tracert www.yahoo.com'''

select * from @results
0

精彩评论

暂无评论...
验证码 换一张
取 消