Execute Successful but No Records

  • I've two stored procedures, one which uses a single SQL statement to return data and one which uses a temporary table to build intermediate data and then return the results by joining the temporary table key values in a SQL statement.  Both these procedures run in Query Analyzer but when I run them from the application the first returns data and the second returns a statement that it executed successfully but did not return records.  Each of these procedures is used to load an ADODB recordset.  The first works well but the second causes an error after I load the recordset and try to extract the data.  I've tested the second procedure in QA against a parameter and it will return 5 rows but obviously not the same procedure and parameter in the application.I'm relatively sure this is because of the procedure not returning the data.  Why would that happen and what could I do to have the data returned? 

    I'm still learning and overcoming some of the seeming vagaries of SQL Server, having only been using it for a year.  Any assistance would be greatly appreciated.

     

     

     

     

  • the problem is that your stored procedure is returning the nuber of rows inserted into you temp table as the first result (which the app will pick up)

    all you need to do is at the start of your procedure

    set NOCOUNT on

    MVDBA

  • Can you post the second SP?

  • SET NOCOUNT ON Worked!  I figured it to be something simple but couldn't see the resulution even though I struggled with it.  Thanks to Mike Vessey.

    Steve King

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply