Q
Problem solve Get help with specific problems with your technologies, process and projects.

Not getting a result set when executing a stored procedure

I created a stored procedure to return me a select statement. See below:

 select nameA from tableA Union Select nameB from tableB
I tried the statement above in the Query Analyzer, and it returned to me a result set. But when I executed it from a stored procedure, I can't get a result set, but I get "The command(s) completed successfully." Did I miss some step to make it return a result set? I am using SQL Server 7.0.

I cannot duplicate the problem you are experiencing.

I, like you, created a stored procedure (using Northwind):

 create procedure usp_mailingLabels as select firstName + ' ' + lastName as contactName from employees union select contactName from customers
However, I was able to execute the procedure and get a result set:
 exec usp_mailingLabels output: contactName Alejandra Camino Alexander Feuer Ana Trujillo . . . Yoshi Tannamuri Yvonne Moncada Zbyszek Piestrzeniewicz

 

For More Information

This was last published in April 2002

Dig Deeper on Microsoft SQL Server Installation

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close