美文网首页
SQL Server 发起http请求

SQL Server 发起http请求

作者: 大象无形_b806 | 来源:发表于2018-12-15 16:29 被阅读0次

--环境设置

sp_configure 'show advanced options', 1;

GO

RECONFIGURE;

GO

sp_configure 'Ole Automation Procedures', 1;

GO

RECONFIGURE;

GO

--创建存储过程

CREATE proc [dbo].[HttpGet]

@Url varchar(1000),

@ReturnText nvarchar(4000)='' output

as                     

Declare @Object as Int

declare @ResponseText nvarchar(4000)

Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;

Exec sp_OAMethod @Object, 'open', NULL, 'get',@Url,'false'

Exec sp_OAMethod @Object, 'send'

Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT

set @ReturnText = @ResponseText

Exec sp_OADestroy @Object

相关文章

网友评论

      本文标题:SQL Server 发起http请求

      本文链接:https://www.haomeiwen.com/subject/ckuahqtx.html