通过 SQL Server 存储过程访问 REST 服务的方法? [英] Way to access a REST Service via a SQL Server stored procedure?
问题描述
我们正在寻找一种从 SQL Server 2008 & 调用 REST 服务的方法.较新的存储过程.我们不需要从该服务中获取任何信息.我们只需要强制调用在存储过程中间运行即可.
We are looking for a way to call a REST service from a SQL Server 2008 & newer stored procedure. We do not need to get any information from this service. We just need to force the call to run in the middle of a stored procedure.
我找到了一些 3rd 方选项或 CLR;但我拒绝认为没有更简单的方法,因为我们只需要拨打电话而不需要任何回报.
I have found some 3rd party options or CLR; but I refuse to think there isn't an easier way since we just need to fire a call and don't need anything in return.
希望有人能解释一下.谢谢!
Hopefully someone can shed some light. Thanks!
推荐答案
您可以创建一个 SQL 代理作业来运行 PowerShell 脚本,然后通过 msdb.dbo.sp_start_job
运行该作业.这样您就不需要任何外部脚本或实用程序,也不需要任何 SQL-CLR.
You could make a SQL Agent job to run a PowerShell script, then run the job via msdb.dbo.sp_start_job
. That way you wouldn't need any external scripts or utilites, nor any SQL-CLR.
您的工作步骤类似于:
$request = [System.Net.WebRequest]::Create('http://stackoverflow.com/')
$result = $request.GetResponse()
这篇关于通过 SQL Server 存储过程访问 REST 服务的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!