sqlserver调用钉钉方法
--一、操作提权 /* --启用Ad Hoc Distributed Queries: exec sp_configure 'show advanced options',1 reconfigure exec sp_configure 'Ad Hoc Distributed Queries',1 reconfigure --使用完成后,关闭Ad Hoc Distributed Queries: exec sp_configure 'Ad Hoc Distributed Queries',0 reconfigure exec sp_configure 'show advanced options',0 reconfigure */ --二、调用钉钉操作 declare @PostData nVARCHAR(max) = '' , declare @ResponseText VARCHAR(max) = '' declare @ServiceUrl AS VARCHAR(1000) set @ServiceUrl = N'https://im.dingtalk.com/(这里填钉钉接口)' set @PostData = N'{"jobNo":"XXXXX","effect":"shsq","msg":"哈哈"}(这里填调用参数)' DECLARE @Object AS INT, @status INT, @returnText AS VARCHAR(8000) , @HttpStatus VARCHAR(200) , @HttpMethod VARCHAR(20) = 'post' EXEC @status = sp_OACreate 'Msxml2.ServerXMLHTTP.3.0', @Object OUT; EXEC @status = sp_OAMethod @Object, 'open', NULL, @HttpMethod, @ServiceUrl, 'false' EXEC @status = sys.sp_OAMethod @Object, 'setRequestHeader', NULL, 'Content-Type', 'application/json; charset=UTF-8' EXEC @status = sp_OAMethod @Object, 'send', NULL, @PostData EXEC @status = sys.sp_OAGetProperty @Object, 'Status', @HttpStatus OUT; EXEC @status = sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT EXEC @status = sp_OADestroy @Object print @ResponseText