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 2005 Forums
 .NET Inside SQL Server (2005)
 calling SP within a select loop

Author  Topic 

asilter
Starting Member

5 Posts

Posted - 2007-10-06 : 06:59:36
i have a stored procedure with one coming id parameter

[CODE]
ALTER PROCEDURE [dbo].[sp_1]
@session_id int
...
[/CODE]

and a view that holds these @session_id s to be sent to the stored procedure.

how could i call this sp_1 in a select loop of the view. I mean i want to call the stored procedure as times as the view has records.

Kristen
Test

22859 Posts

Posted - 2007-10-06 : 07:42:29
You can't do that in the VIEW itself, you would have to write a loop (or Cursor) in SQL to make the Sproc calls.

If you can express the Sproc in a User Defined Function then you would be able to use that in your View.

Kristen
Go to Top of Page
   

- Advertisement -