SQLServe 에서 HTTP GET 호출하는 예제 입니다.급한경우 잘 쓰면 좋을것 같습니다.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: mulder
-- Create date:
-- Description: URL Tester
-- OLE Automation in SQLServer
-- http://forums.asp.net/t/1425747.aspx
-- pre-work-start
-- EXEC sp_configure 'Ole Automation Procedures';
-- sp_configure 'show advanced options', 1;
-- RECONFIGURE;
-- sp_configure 'Ole Automation Procedures', 1;
-- RECONFIGURE;
-- pre-work-end
-- select dbo.fncValidateURL ('http://127.0.0.1:8080/test/001');
-- =============================================
ALTER FUNCTION dbo.fncValidateURL(@URL VARCHAR(300))
RETURNS BIT
AS
BEGIN
DECLARE @Object INT
DECLARE @Return TINYINT
DECLARE @Valid BIT SET @Valid = 0 --default to false
--create the XMLHTTP object
EXEC @Return = sp_oacreate 'MSXML2.ServerXMLHTTP.3.0', @Object OUTPUT
IF @Return = 0
BEGIN
DECLARE @Method VARCHAR(350)
--define setTimeouts method
--Resolve, Connect, Send, Receive
SET @Method = 'setTimeouts(45000, 45000, 45000, 45000)'
--set the timeouts
EXEC @Return = sp_oamethod @Object, @Method
IF @Return = 0
BEGIN
--define open method
SET @Method = 'open("GET", "' + @URL + '", false)'
--Open the connection
EXEC @Return = sp_oamethod @Object, @Method
END
IF @Return = 0
BEGIN
--SEND the request
EXEC @Return = sp_oamethod @Object, 'send()'
END
IF @Return = 0
BEGIN
DECLARE @Output INT
EXEC @Return = sp_oamethod @Object, 'status', @Output OUTPUT
IF @Output = 200
BEGIN
SET @Valid = 1
END
END
END
--destroy the object
EXEC sp_oadestroy @Object
RETURN (@Valid)
END