Вот мой код, который работает.
exec @hr = sp_OACreate 'MSXML2.ServerXMLHttp', @obj OUT
if @hr < 0 begin Raiserror('sp_OACreate MSXML2.ServerXMLHttp failed',16,1)
return end
exec @hr = sp_OAMethod @obj, 'Open', NULL, 'GET', @UrlString, false
if @hr <0 begin set @msg = 'sp_OAMethod Open failed' goto eh end
exec @hr = sp_OAMethod @obj, 'send'
if @hr <0 begin set @msg = 'sp_OAMethod Send failed' goto eh end
exec @hr = sp_OAGetProperty @obj, 'status', @status OUT
if @hr <0 begin set @msg = 'sp_OAMethod read status failed' goto eh end
if @status <> 200 begin set @msg = 'sp_OAMethod http status ' +str(@status) goto eh end
exec @hr = sp_OAGetProperty @obj, 'responseText', @response OUT
if @hr <0 begin set @msg = 'sp_OAMethod read response failed' goto eh end
exec @hr = sp_OADestroy @obj
select @response
......
эх:
exec @hr = sp_OADestroy @obj
Raiserror(@msg, 16, 1)
Return