Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Handling Empty Recordsets in a SP

Author  Topic 

Nick
Posting Yak Master

155 Posts

Posted - 2001-10-17 : 14:32:21
Hi-

I'm still trying to figure out the intricacies of stored procedures. I've just run across a new problem.

I'm migrating my code from SQL statements run within an ASP page to a stored procedure. In the previous code I would run a query. If the query returned results (which at most would only be one row) it would do what it had to do. However if the resulting recordset was empty it would do something else.

Now that I'm trying to move this to a stored procedure I was going to use OUTPUT fields for the fields that were being returned. Because there is only one row returned I wasn't going to assign it to a recordset.

Is there a way I can return a specific value (say -1) if the recordset ends up empty. Something I can check for instead of RS.EOF? Thanks!

   

- Advertisement -