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)
 How to get result clomn list from the SP

Author  Topic 

Yong Ji
Starting Member

5 Posts

Posted - 2007-10-16 : 17:21:21
Hi
Is there a way to find out result clomn list of a SP?
For example

If there's a SP like following

create proc jy_test
as
begin
select col1, col2 from tabA
end

I'd like to know col1 and col2 will be returned from the SP and if possible, I also like to know the data type of those.
Thank you in advance.

Kristen
Test

22859 Posts

Posted - 2007-10-17 : 00:53:32
See:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56418
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=74776

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-17 : 02:48:28
select * from information_schema.routine_columns where routine_name='your sp name'


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Yong Ji
Starting Member

5 Posts

Posted - 2007-10-17 : 03:09:36
The following is definition of the routine_columns view.

Contains one row for each column returned by the table-valued functions accessible to the current user in the current database.

So it doesn't have the information for the SP.

quote:
Originally posted by madhivanan

select * from information_schema.routine_columns where routine_name='your sp name'


Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-10-17 : 03:54:24
Did you try the links I provided?
Go to Top of Page

Yong Ji
Starting Member

5 Posts

Posted - 2007-10-17 : 04:39:43
Yes, thank you for the valuable information.
I think I got an idea.

quote:
Originally posted by Kristen

Did you try the links I provided?

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-10-17 : 04:50:50
quote:
Originally posted by Yong Ji

The following is definition of the routine_columns view.

Contains one row for each column returned by the table-valued functions accessible to the current user in the current database.

So it doesn't have the information for the SP.

quote:
Originally posted by madhivanan

select * from information_schema.routine_columns where routine_name='your sp name'


Madhivanan

Failing to plan is Planning to fail




Yes I think I have given you the wrong query

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -