Cron job to connect to sql server and run a sproc using python -
I want to learn a dragon, and my job is to run a SQL Server 2008 stored procedure through a cron job.
Can I move through a script in Python?
I'm assuming you mean Microsoft's SQL server ... < / P>
#! / Usr / bin / python import pymssql con = pymssql.connect (host = 'xxxxx', user = 'xxxx', password = 'xxxxx', database = 'xxxxx') cur = con.cursor () query = "DECLARE @ ID INT; EXPUTE sp_GetUserID; SELECT @id; "Cur.execute (query) outputparameter = cur.fetchall () con.commit () taken from con.close ()
(Copyright Retained)
Put a script in it and run it from the cron ...
Comments
Post a Comment