PyODBC Stored proc calling

K

king kikapu

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top