Hi everyone,
My aim is to connect to web api via MSSQL and post data. I'm looking for such an example, I couldn't find a proper example.
Could you please help with such a simple example.
Hi AliYilmaz,
Refer below query.
SQL
Declare @Object as Int; Declare @ResponseText as Varchar(8000); Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT; Exec sp_OAMethod @Object, 'open', NULL, 'get', 'API_Url', 'false' Exec sp_OAMethod @Object, 'send' Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT Select @ResponseText Exec sp_OADestroy @Object
Reference:
https://stackoverflow.com/questions/22067593/calling-an-api-from-sql-server-stored-procedure/52686957
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.