zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    sop服务治理
    调用链跟踪基本原理
    spring源码之bean的初始化及循环引用
    单调栈
    SpringBoot启动源码及自定义starter
    深入理解kafka
    Netty小结
    Oooooooooooooooooooooooooooooooooooooooooops, AN EMPTY AREA here.
    牛客OI周赛7-提高组 A 小睿睿的等式
    素数筛法求素数
  • 原文地址:https://www.cnblogs.com/damugua/p/15435128.html
Copyright © 2011-2022 走看看