[python-win32] adodbapi and stored procedure output parameters on MSSQL

Randy Syring randy at rcs-comp.com
Wed May 20 17:18:01 CEST 2009


I found this post:

http://bytes.com/groups/python/38259-sql-server-stored-prcedures-output-parameters

which was helpful in getting me started.  However, that method does not 
yield the output parameters if a recordset is output in the SP.  So, if 
my SP is:

    CREATE PROCEDURE sp_test_only_output
    @param INTEGER OUTPUT
    AS
    BEGIN
    select @param = 10
    END

Then:

    assert [10] == self.cur.callproc('sp_test_only_output',(999,))

But, if my SP is:

    CREATE PROCEDURE sp_test_output_and_select
    @param INTEGER OUTPUT
    AS
    BEGIN
    select 'one', 'two'
    select @param = 10
    END

then:

    self.cur.callproc('sp_test_output_and_select',(999,)) == [999]

A full test that can be run with Nose: http://paste.pocoo.org/show/118219/

Can you please help me figure out what is going on.  I realize output 
parameters are not the best solution, but I am working with systems that 
I can't change the SPs on and would like to use Python rather than be 
forced into using a different language.

Thank you!

-- 
--------------------------------------
Randy Syring
RCS Computers & Web Solutions
502-644-4776
http://www.rcs-comp.com

"Whether, then, you eat or drink or 
whatever you do, do all to the glory
of God." 1 Cor 10:31

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090520/593c0637/attachment.htm>


More information about the python-win32 mailing list