2009-10-19 83 views

回答

1

我假設你的意思是微軟的SQL ...服務器

#! /usr/bin/python 

import pymssql 
con = pymssql.connect (host='xxxxx',user='xxxx', 
         password='xxxxx',database='xxxxx') 
cur = con.cursor() 
query = "DECLARE @id INT; EXECUTE sp_GetUserID; SELECT @id;" 
cur.execute(query) 
outputparameter = cur.fetchall() 
con.commit() 
con.close() 

http://coding.derkeiler.com/Archive/Python/comp.lang.python/2008-10/msg02620.html兩者(版權保留)

假如把它放在一個腳本,並從cron運行它...

Check this question too.