标签:taf tde use als data user proc form open
--开启Sql Server 通讯配置--
sp_configure ‘show advanced options‘, 1;
GO
RECONFIGURE;
GO
sp_configure ‘Ole Automation Procedures‘, 1;
GO
RECONFIGURE;
GO
EXEC sp_configure ‘Ole Automation Procedures‘;
GO
--GET
declare @ServiceUrl as varchar(1000)
--set @ServiceUrl = ‘http://api.data.rx/api/rs/getdeptstaffstat?city=18®ion=0‘
set @ServiceUrl = ‘http://edu.rx/a/api/getQuesUserNum?region=11&startTime=2018-8-8&endTime=2018-8-25‘
DECLARE @data varchar(max);
set @data=‘‘
Declare @Object as Int
Declare @ResponseText AS VARCHAR(8000);
Exec sp_OACreate ‘Msxml2.ServerXMLHTTP.3.0‘, @Object OUT;
Exec sp_OAMethod @Object, ‘open‘, NULL, ‘post‘,@ServiceUrl,‘false‘
Exec sp_OAMethod @Object, ‘send‘, NULL, @data --发送数据
Exec sp_OAMethod @Object, ‘responseText‘, @ResponseText OUTPUT
EXEC sp_OAGetErrorInfo @Object --异常输出
Select @ResponseText
Exec sp_OADestroy @Object
GO
--post
declare @ServiceUrl as varchar(1000)
set @ServiceUrl = ‘http://edu.rx/a/api/getQuesUserNum‘
DECLARE @data varchar(max);
--发送数据
set @data=‘region=11&startTime=2018-8-8&endTime=2018-8-25‘
Declare @Object as Int
Declare @ResponseText AS varchar(8000) ;
Exec sp_OACreate ‘Msxml2.ServerXMLHTTP.3.0‘, @Object OUT;
Exec sp_OAMethod @Object, ‘open‘, NULL, ‘POST‘,@ServiceUrl,‘false‘
Exec sp_OAMethod @Object, ‘setRequestHeader‘, NULL, ‘Content-Type‘,‘application/x-www-form-urlencoded‘
Exec sp_OAMethod @Object, ‘send‘, NULL, @data --发送数据
Exec sp_OAMethod @Object, ‘responseText‘, @ResponseText OUTPUT
EXEC sp_OAGetErrorInfo @Object --异常输出
Select @ResponseText
Exec sp_OADestroy @Object
GO
标签:taf tde use als data user proc form open
原文地址:https://www.cnblogs.com/Mzg121584668/p/10012771.html