PyODBC Stored proc calling

king kikapu aboudouvas at panafonet.gr
Thu Jan 18 11:25:54 CET 2007


Hi to all,

can anyone give me a jump-start about how to call Stored Procedures
from PyODBC ??
I want to execute a very simple testing Stored Procedure on an Sql
Server database.

I started using PyODBC and code like the following

cnxn = pyodbc.connect('DRIVER={SQL
Server};SERVER=hercules;DATABASE=pubs;UID=sa;PWD=pwd'')

for row in cnxn.execute("select au_fname from authors"):
    print row.au_fname
cnxn.close()

and based on this, i can now write more complex ad-hoc sql string to
get/update data.
But how i can actually call Stored Procedures and passing parameters to
them ??

Let's say i have the following SP:

create procedure test_bed(@data varchar(100))
as
// do something here.


Any help ??

Thanks in advance




More information about the Python-list mailing list