473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

using adodbapi - problem returning Values from Stored Procedure

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
connStrSQLServer = r"Provider=SQLOLEDB.1; User ID=sa; Password=tester; Initial Catalog=someDB;Data Source=someSource"
db = adodbapi.connect(connStrSQLServer)
cursor = db.cursor()

sql = """test_procedure """

cursor.execute(sql)
results = cursor.fetchall()

MY TRANSACT SQL CODE IS:

ALTER PROCEDURE dbo.test_procedure

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\Lib\site-packages\adodbapi\adodbapi.py", line 692, in fetch
ll
return self._fetch()
File "C:\Python23\Lib\site-packages\adodbapi\adodbapi.py", line 623, in _fetc

self._raiseCursorError(Error,None)
File "C:\Python23\Lib\site-packages\adodbapi\adodbapi.py", line 407, in _rais
CursorError
eh(self.conn,self,errorclass,errorvalue)
File "C:\Python23\Lib\site-packages\adodbapi\adodbapi.py", line 38, in standa
dErrorHandler
raise errorclass(errorvalue)
Error: None
[]

This works
The python code is the same
The SQL Code is:

ALTER PROCEDURE dbo.test_procedure

AS
INSERT INTO somePhysicalTable
VALUES (123)
SELECT * FROM somePhysicalTable
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***********@ge.com
www.gesecurity.com

791 Park of Commerce Blvd., Suite 100
Boca Raton, FL, 33487, U.S.A.
GE Security, Inc.

Jul 19 '05 #1
0 1949

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: nightmarch | last post by:
I want use crsr.nextset() , But I got errors like following: >>> connStr = "Provider=MSDAORA.1;Password=jmpower;User ID=jmpower;Data Source=jmgis_agps3;Persist Security Info=True" >>> import...
4
by: Michael Trosen | last post by:
Hi Everyone, I hope someone can help, I'm pretty new to pro*c programming. I have the following application setup: a pro*c program calls a stored procedure and recieves a cursor back: the...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
0
by: sbest | last post by:
Hi all, I am trying to execute a MS-SQL 2000 stored proedure from PHP 4.2.2 and return the single row of 3 output values. I've whittled down the error messages so that I'm now mainly getting an...
9
by: joun | last post by:
Hi all, i'm using this code to insert records into an Access table from asp.net, using a stored procedure, called qry_InsertData: PARAMETERS Long, Long, Text(20), Long, DateTime; INSERT...
1
by: hlam | last post by:
I am configuring an SqlDataAdapter using a stored procedure (which uses UNIONS and a Temporary Table) in Visual Studio.Net My stored procedure consists of: SELECT ... INTO #tbltemporary ...
1
by: Joe Van Meer | last post by:
Hi all, I have an app that currently runs through 3 seperate stored procedures each returning a count of records. What I would like to do is combine these calls into one call, however I am...
2
by: jzogg7272 | last post by:
In my code I am executing a stored procedure to do a single row insert. I check the return value of the execution and I am getting -1, whereas a few weeks ago it was returning 0. Actually, I found...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.