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
 Transact-SQL (2000)
 Executing Stored Procedure with Select Results

Author  Topic 

axisperfect
Starting Member

21 Posts

Posted - 2004-12-17 : 02:51:58

I was wondering if it was possible to feed the results of a query into a stored procedure. pseudocode

1. select param1, param2, param3 from table
2. for each row, exec sp_mystoreprocedure param1, param2, param3


I suspect it's do-able using cursors, but I haven't really figured out how cursors are done-- and if I understand correctly, they're really to be avoided as much as possible.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-12-17 : 05:36:09
you can't execute an sproc for each line in resultset.
you can do this with a user defined function. if you're not changing the db structure in your sproc use UDF.

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

- Advertisement -