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)
 Columns of Stored Procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-02 : 08:26:03
Thomas writes "How do I get all columns (including type) that are returned by a stored procedure?

I can use "SET FMTONLY ON" but this seems not to work with STPs which are using a temporary table."

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-12-02 : 12:20:39
What do you mean all columns that are returned by a stored procedure? Is the stored procedure returning a result set or an OUTPUT parameter? If not, then you need to code it so that it does. Here is an example of a result set:

CREATE PROC SomeProc
AS
SELECT Column1, Column2
FROM Table1
WHERE Column3 = 0

RETURN

The above stored procedure will return Column1 and Column2 as a result set. Show us your stored procedure and let us know what you want returned. And yes stored procedures can return result sets from a temporary table. But you can to tell it to do it.

Tara
Go to Top of Page

jcortiz1
Starting Member

3 Posts

Posted - 2004-07-27 : 17:23:16

Please.
The stored procedure is returning a result set!!!
by example:
CREATE PROC SomeProc
AS
SELECT Column1, Column2
FROM Table1
WHERE Column3 = 0

RETURN

jcortiz1
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-07-27 : 18:08:28
What is your question?

Tara
Go to Top of Page

Pat Phelan
Posting Yak Master

187 Posts

Posted - 2004-07-27 : 18:23:56
Can we back up a step or two, and try to figure out what you're trying to accomplish instead of concentrating on details?

It sounds to me like the question is related to how an application can retrieve a stored procedure if that application doesn't know the format of the result set(s) in advance. One of the problems that the question as posted seems to ignore is that a procedure can return multiple result sets in a single call or in response to different parameters, so a procedure doesn't have to have only one schema.

Can you try to explain what you are trying to do, without getting too bogged down in how you are trying to do it?

-PatP
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2004-07-28 : 02:01:28
Similar thing came up just recently, dunno if its answering the right question though
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=37875

Kristen
Go to Top of Page
   

- Advertisement -