PQ Systems Knowledge Base

CR: SQL Server Stored Procedures Returns No Records

Revision Date: 2005-09-19

Problem:

In some cases when using a SQL Server stored procedure to fetch data for a chart no data is returned and an error message is displayed, or the program appears to “hang”.

Several different error messages may be returned depending upon the version of CHARTrunner.  Some customers have reported that CHARTrunner appears to “hang” when the chart is drawn.  Starting in version 1.6.49 the error message says “The stored procedure did not return any records”.

Solution:

This situation can occur if the stored procedure contains one or more action (e.g. INSERT, DELETE, UPDATE) or SELECT statements prior to the final SELECT statement that actually returns the records for the chart.  In this case the solution is to use SET NOCOUNT ON at the top of the stored procedure.

Apparently with SET NOCOUNT OFF (the default) SQL Server sends a "number of rows affected" message to the ADO provider for each action statement or SELECT statement in the stored procedure.  This confuses the ADO provider and results in the error condition.

Using SET NOCOUNT ON tells SQL Server not to send these "number of rows affected" messages and thus ADO doesn't get confused.

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Quick Edit

Export to PDF

User Opinions (0 votes)

No users have voted.

How would you rate this answer?



Thank you for rating this answer.

Related Articles

No related articles were found.

Attachments

No attachments were found.

Continue