Hi All,
I am having problem returning values from a Stored Procedure that creates a dynamic table (table variable) inserts values during a procedure and then I select from that dynamic table to furnish values to python.
This does not work
MY PYTHON CODE IS:
import adodbapi
connStrSQLServe r = r"Provider=SQLO LEDB.1; User ID=sa; Password=tester ; Initial Catalog=someDB; Data Source=someSour ce"
db = adodbapi.connec t(connStrSQLSer ver)
cursor = db.cursor()
sql = """test_procedu re """
cursor.execute( sql)
results = cursor.fetchall ()
MY TRANSACT SQL CODE IS:
ALTER PROCEDURE dbo.test_proced ure
AS
DECLARE @dynamicTable TABLE (col1 int)
INSERT INTO @dynamicTable
VALUES (123)
SELECT * FROM @dynamicTable
THIS IS THE ERROR I GET
results = cursor.fetchall ()
File "C:\Python23\Li b\site-packages\adodba pi\adodbapi.py" , line 692, in fetch
ll
return self._fetch()
File "C:\Python23\Li b\site-packages\adodba pi\adodbapi.py" , line 623, in _fetc
self._raiseCurs orError(Error,N one)
File "C:\Python23\Li b\site-packages\adodba pi\adodbapi.py" , line 407, in _rais
CursorError
eh(self.conn,se lf,errorclass,e rrorvalue)
File "C:\Python23\Li b\site-packages\adodba pi\adodbapi.py" , line 38, in standa
dErrorHandler
raise errorclass(erro rvalue)
Error: None
[]
This works
The python code is the same
The SQL Code is:
ALTER PROCEDURE dbo.test_proced ure
AS
INSERT INTO somePhysicalTab le
VALUES (123)
SELECT * FROM somePhysicalTab le
Notice that the only difference between the 2 procedures is that in one case I am using a dynamic (table variable) table and in the other I am using an actual physical table. Does anyone have a clue why one works and the other does not.
Any help appreciated! Thanks in advance
Thanks,
Moiz Golawala
GE Infrastructure, Security
Software Engineer
Enterprise Solutions
T 561 912 5972
F 561 994 6572
E mo***********@g e.com
www.gesecurity.com
791 Park of Commerce Blvd., Suite 100
Boca Raton, FL, 33487, U.S.A.
GE Security, Inc.