Stored Procedures with no results

Published on May 13, 2006

I've been having a problem with big hairy report that I have been writing. The T-SQL for the report involved creating a cursor, traversing the cursor and inserting records into a temporary table. Because it was big and ugly I wrapped it up in a stored proc. The problem was that when I deployed the report and ran it from our Visual Basic app using ADO to execute the stored proc, it failed giving an error that basically said that it did not get any results back. The strange thing was that it worked fine against SQL 2005, but failed on SQL 2000! Actually that's not all that strange, SQL 2005 has fixed so many things that didn't work in SQL 2000, but that's another post.

The solution: Remove the Print statement that had been left in for debugging purposes. I have to thank some guy named Danny on a microsoft discussion group who not only posted the same question but came back and answered it himself.