Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion No results when using known good SQL code
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mortonj  
View profile  
 More options Oct 31 2011, 9:20 am
From: mortonj <mort...@navcanada.ca>
Date: Mon, 31 Oct 2011 06:20:31 -0700 (PDT)
Local: Mon, Oct 31 2011 9:20 am
Subject: Re: No results when using known good SQL code
First off, thanks for taking the time to help.  And thanks for
mentioning that particular SQL "feature".

I've tried both ideas, together and separately.   I even tried
throwing in a couple of hundred "cursor.nextset()" statements to see
if I could force an exception to be thrown.  No luck, the python code
always returns the "no results" error at the "cursor.fetchone()" line
no matter how many "cursor.nextset()" statements are inserted.

I do not have the rights to create stored SQL procedures.  So I am
trying to get a similar effect by using pyobdc to submit the fixed
sequence of SQL statements.  This approach works properly with all of
my other queries without needing either change.
The only obvious difference is that all of my other "cursor.execute()"
SQL queries contain only one select statement.

This difference makes me wonder if what I am trying to do (use more
than 1 select statement in a "cursor.execute" call) is confusing
pyobdc and pushing it beyond what it is designed to do.

Are there any other ideas out there of how to get what I want?

On Oct 27, 5:09 pm, Michael Kleehammer <mkleeham...@gmail.com> wrote:

> Summary: Add "SET NOCOUNT ON" to the top of your stored procedure.

> SQL Server has a very annoying habit of returning *everything* as part of
> the "result" of a stored procedure.  For example, if you have a stored
> procedure that deletes 3 rows and then selects some rows, the stored
> procedure actually returns two result sets: the first contains the number
> 3, since it is the number of items deleted.  The second contains the
> results you selected.

> If you add SET NOCOUNT ON, the non-select results will not be returned.

> You can also use Cursor.nextset() to "step over" non-select results.

> I may consider automatically doing this unless a flag is used to turn it
> off.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.