클리엘
CLIEL LAB
클리엘
전체 방문자
131,838
오늘
148
어제
340
  • 분류 전체보기 (442) N
    • Mobile (47)
      • Kotlin (47)
    • Web (84)
      • NestJS (9)
      • HTML5 & CSS3 (38)
      • Javascript (20)
      • TypeScript (6)
      • JQuery (11)
    • .NET (233) N
      • C# (57) N
      • ASP.NET Core (31)
      • Windows API for .NET (128)
    • Server (50)
      • SQL Server (8)
      • MariaDB (18)
      • Windows Server (5)
      • node.js (19)
    • System (12)
      • 작업LOG (12)
    • Review (11)
    • ETC (5)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

  • 블로그 정리

인기 글

  • [C#] C#과 .NET6 시작하기 - 3.⋯
    2022.06.24
    [C#] C#과 .NET6 시작하기 - 3.⋯
  • [C#] C# 개요 - 3. 기타 Consol⋯
    2022.06.24
    [C#] C# 개요 - 3. 기타 Consol⋯
  • [C#] 인터페이스(Interface)와⋯
    2022.06.24
    [C#] 인터페이스(Interface)와⋯
  • [C#] 예외처리
    2022.06.24
    [C#] 예외처리
  • [C#] C#과 OOP(Object-Oriented⋯
    2022.06.24
    [C#] C#과 OOP(Object-Oriented⋯

태그

  • c#
  • Windows API
  • 메서드
  • JavaScript
  • android
  • MariaDB
  • HTML5
  • NestJS
  • Kotlin
  • android studio
  • node.js
  • asp.net core
  • jQuery
  • asp.net core web api
  • TypeScript
  • CentOS
  • CSS3
  • 변수
  • .NET
  • EF-Core

최근 댓글

  • 흠... CACLS는 더이상 사용하지⋯
    클리엘
  • 안녕하세요! 아래 명령 하고부⋯
    방문자
  • 죄송합니다. 관련글을 작성한지⋯
    클리엘
  • 네 맞습니다. 본문에서는 표기⋯
    클리엘
  • 6000 ms 는 6초아닌가요?
    react

최근 글

  • [C#] LINQ(Language INtegrated⋯
    2022.07.05
    [C#] LINQ(Language INtegrated⋯
  • [C#] LINQ(Language INtegrated⋯
    2022.07.05
  • [C#] LINQ(Language INtegrated⋯
    2022.07.05
    [C#] LINQ(Language INtegrated⋯
  • [.NET] 닷넷 Type 사용하기 - 8⋯
    2022.06.26
    [.NET] 닷넷 Type 사용하기 - 8⋯
  • [.NET] 닷넷 Type 사용하기 - 7⋯
    2022.06.26

티스토리

hELLO · Designed By 정상우.
클리엘

CLIEL LAB

Server/SQL Server

[MS-SQL] http 요청 보내기

2020. 10. 27. 10:50
728x90
--실행시 에러가 나면 아래 옵션을 활성화 합니다.
--Exec sp_configure 'show advanced options', 1;
--RECONFIGURE;
--Exec sp_configure 'Ole Automation Procedures', 1;
--RECONFIGURE;

--더이상 필요하지 않으면 옵션을 되돌립니다.
--Exec sp_configure 'show advanced options', 0;
--Exec sp_configure 'Ole Automation Procedures', 0;

--Declare @authHeader nvarchar(64);
Declare @contentType	nvarchar(64);
Declare @postData		nvarchar(2000);
Declare @responseText	nvarchar(2000);
Declare @responseXML	nvarchar(2000);
Declare @ret			int;
Declare @status			nvarchar(32);
Declare @statusText		nvarchar(32);
Declare @token			int;
Declare @url			nvarchar(256);

--Header값이 필요한 경우 사용합니다.
--SET @authHeader = 'BASIC 0123456789';
Set @contentType = 'application/x-www-form-urlencoded';
--Post로 전송할 값은 아래와 같이 사용합니다.
--SET @postData = 'ID=abcdef&age=1234'
Set @url = 'http://www.google.com'

-- Open the connection.
Exec @ret = sp_OACreate 'MSXML2.ServerXMLHTTP', @token Out;
If @ret <> 0 Raiserror('Unable to open HTTP connection.', 10, 1);

-- Send the request.
-- GET/POST 여부에 따라 설정합니다.
Exec @ret = sp_OAMethod @token, 'open', NULL, 'GET', @url, 'false';
--EXEC @ret = sp_OAMethod @token, 'open', NULL, 'POST', @url, 'false';
--EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Authentication', @authHeader;
Exec @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Content-type', @contentType;
--EXEC @ret = sp_OAMethod @token, 'send', NULL, @postData;

-- Handle the response.
Exec @ret = sp_OAGetProperty @token, 'status', @status Out;
Exec @ret = sp_OAGetProperty @token, 'statusText', @statusText Out;
Exec @ret = sp_OAGetProperty @token, 'responseText', @responseText Out;

-- Show the response.
Print 'Status: ' + @status + ' (' + @statusText + ')';
Print 'Response text: ' + @responseText;

-- Close the connection.
Exec @ret = sp_OADestroy @token;
IF @ret <> 0 RAISERROR('Unable to close HTTP connection.', 10, 1);
728x90
저작자표시비영리변경금지

'Server > SQL Server' 카테고리의 다른 글

[MSSQL] Database Offline  (0) 2022.01.12
[SQL Server] Memory 관리  (0) 2021.11.23
[MS-SQL] http 요청 보내기  (0) 2020.10.27
[SQL Server] .NET 어셈블리 등록  (0) 2020.06.02
[MSSQL] 서버에서 지연되는(처리시간이 오래 걸리는) 쿼리(Query)찾기  (2) 2020.03.17
[SQL Server] 현재 주차및 주차에 해당하는 날짜 구하기  (0) 2019.09.17
    'Server/SQL Server' 카테고리의 다른 글
    • [MSSQL] Database Offline
    • [SQL Server] Memory 관리
    • [SQL Server] .NET 어셈블리 등록
    • [MSSQL] 서버에서 지연되는(처리시간이 오래 걸리는) 쿼리(Query)찾기
    HTTP, MSSQL
    클리엘
    클리엘
    누구냐 넌?
    댓글쓰기
    다음 글
    [SQL Server] Memory 관리
    이전 글
    [SQL Server] .NET 어셈블리 등록
    • 이전
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 다음

    티스토리툴바