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 handle Output data of Stored Procedure

Author  Topic 

Fatalsniper
Starting Member

45 Posts

Posted - 2005-12-26 : 16:28:46
Hey there,

How can I handle the output of a Stored Procedure like if it was a view or table...
something like this:

SELECT TOP 10 * FROM spname WHERE ...


Thanks y'all in advance...

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2005-12-26 : 22:52:34
for handling sps output you need to write
execute <spname> <list of parameters>
but you can do this using a table-valued UDF
select * from <UDF>
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-12-27 : 08:45:29
do top 10 in you sproc.


Go with the flow & have fun! Else fight the flow
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-27 : 09:04:10
If you want to limit the output of the sp, then pass it as parameter and use Set Rowcount @Limit

Create proc .........
as
Set Rowcount @Limit
Select........
Set Rowcount 0


Madhivanan

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

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2005-12-27 : 09:32:01
Tell how u want to call the stored procedure & how u want the output to be?
ex.
1. Call stored proc in a client program & get the results of that to a recordset ?
2. Need to use specifically a stored procedure approach or is it OK to go by UDF approach ?
3. U want to run the query exactly in a way similar to what u write or is it OK to have any other way?
4. Is it just u want to get the output of the stored procedure (which returns a set of records) ?
Go to Top of Page
   

- Advertisement -