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
  • 相关阅读:
    云栖大会2020
    云栖大会2020
    云栖大会2020
    《利用知识图提高抽象摘要的事实正确性》
    onkeyup="this.value=this.value.replace(/[^1-9]D*$/,'')"
    javamail发送excel附件
    model.org.orgId
    window.parent.returnValue
    删除了用户的org和role
    window.top.popForm()表单以窗口的形式弹出
  • 原文地址:https://www.cnblogs.com/damugua/p/15435128.html
Copyright © 2011-2022 走看看