Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
SQL server 7
Database 6
Tips 5
Tricks 5
#SQLServer 3
Backup 2
MSSQL 1
'E0' 1
isnumeric 1
Issues 1

Archive · View All
December 2011 4
March 2012 2
January 2012 1

Raghunath Bhandari's Blog

Http POST or GET Method from MSSQL

Dec 11 2011 8:26AM by Raghunath Bhandari   

Few days back I was trying to send sql data to my web API using Store-procedure and it was simple and interesting, you can use the same way to call web http post or get both method using such way

CREATE function [dbo].[HttpGetMethod]

(
@url varchar(8000)
)
returns varchar(8000)
as
BEGIN


DECLARE @win int
DECLARE @HttpWinRequest int

DECLARE @ResultText varchar(8000)


EXEC @HttpWinRequest=sp_OACreate 'WinHttp.WinHttpRequest.5.1',@win OUT

IF @HttpWinRequest <> 0 EXEC sp_OAGetErrorInfo @win


EXEC @HttpWinRequest=sp_OAMethod @win, 'Open',NULL,'GET',@url,'false'

IF @HttpWinRequest <> 0 EXEC sp_OAGetErrorInfo @win



EXEC @HttpWinRequest=sp_OAMethod @win,'Send'
IF @HttpWinRequest <> 0 EXEC sp_OAGetErrorInfo @win



EXEC @HttpWinRequest=sp_OAGetProperty @win,'ResponseText',@ResultText OUTPUT

IF @HttpWinRequest <> 0 EXEC sp_OAGetErrorInfo @win


EXEC @HttpWinRequest=sp_OADestroy @win

IF @HttpWinRequest <> 0 EXEC sp_OAGetErrorInfo @win



RETURN @ResultText


END


Call the function:

-- Select dbo.[HttpGetMethod]('http://localhost/default.asp?Name=John')

Result:

Your Result: John

default.asp can be:

<%

    response.write "Your Result: "&  request("Name")


%>

Tags: mssql http get, http post from procedure, http method from mssql, Http POST or GET Method from MSSQL, mssql Http POST method, get method, web api from mssql, Database, SQL server,


Raghunath Bhandari
183 · 1% · 253
2
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • There are some inherent issues with using OLE Automation, the most important being that the code runs within the context of the SQL Server service. If something crashes, it brings down the entire SQL Server service.

    A better option would be to use a SQL CLR function or stored procedure.

    Would you be comfortable translating this to a SQL CLR function or stored procedure, perhaps using VB or C#?

    commented on Dec 30 2011 10:38AM
    Marc Jellinek
    97 · 2% · 545

Your Comment


Sign Up or Login to post a comment.

"Http POST or GET Method from MSSQL" rated 5 out of 5 by 2 readers
Http POST or GET Method from MSSQL , 5.0 out of 5 based on 2 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]