简体   繁体   English

如何从 SQL Server 执行 Python 文件?

[英]How do I execute Python file from SQL Server?

I wrote a Trigger in SQL Server such that if values in one table updates, the trigger updates values in another table.我在 SQL Server 中编写了一个触发器,这样如果一个表中的值更新,触发器就会更新另一个表中的值。 I want a python script to kick off and push that updated data to SharePoint.我想要一个 python 脚本来启动并将更新的数据推送到 SharePoint。 I searched online but couldn't find anything that calls a Python script or ways to execute Python script right upon completion of a trigger.我在网上搜索,但找不到任何调用 Python 脚本的内容或在完成触发器后立即执行 Python 脚本的方法。 I know I can schedule the script but is there a way to kick off a job in SQL Server upon completion of a trigger?我知道我可以安排脚本,但是有没有办法在触发器完成后启动 SQL Server 中的作业? Thanks谢谢

I just added the code below in the trigger to call a job (not scheduled) to run it and it works perfectly fine.我只是在触发器中添加了下面的代码来调用一个作业(未安排)来运行它,它工作得非常好。

...
begin
 EXEC msdb..sp_start_job
 @job_name = 'JOB NAME';
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM