Run Python Script from MSSQL

前端 未结 1 404
予麋鹿
予麋鹿 2020-12-19 20:13

I want to Run or Execute a Python Script from MSSQL 2008.

I have a server with python, and what i want is that any PC in the local network can execute that scripts w

1条回答
  •  春和景丽
    2020-12-19 20:57

    It worked using

    EXEC xp_cmdshell 'C:/.../python.exe C:\...\script.py';  
    GO
    

    One problem is that you need to use a .exe in the xp_cmdshell, so just with the python command it doesn't work, you must use the python.exe. Another problem was that the python script must be in the computer that is executing the script, previously the script was in a common server, but it denied the permission, and when the script was changed of directory to this server, it worked!.

    0 讨论(0)
提交回复
热议问题