从sql中调用tracert和ping并将结果放入sql表中

发布于 2024-08-14 06:11:48 字数 146 浏览 5 评论 0原文

我需要创建一个存储过程,它将获取目标IP,然后调用tracert或ping,然后将结果写入sql表,这样我就可以在网页中向用户显示结果。 可以这样做吗?如果是的话,请告诉我如何做,因为我已经搜索了很多,但没有找到合适的解决方案。 如果不是,你有什么建议?

谢谢

I need to create a stored procedure which will get destination 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人问我粥可暖 2024-08-21 06:11:48

根据需要修改 -

declare @results table(result varchar(500))

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

select * from @results

与tracert类似

declare @results table(result varchar(500))

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

select * from @results

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文