whorsfall
asked on
SQL exexute store procedure with results of a query.
Hi,
How can I execute a store procedure with the results of a sql query. Here is my attempt that I only got half way with.
In the example below I want to take the AssigmentID and execute each value returned to call a stored procedure.
In this example the ids that would return from the first select are:
id
16777359
16777357
16777361
16777358
16777360
Thanks,
ward.
How can I execute a store procedure with the results of a sql query. Here is my attempt that I only got half way with.
In the example below I want to take the AssigmentID and execute each value returned to call a stored procedure.
In this example the ids that would return from the first select are:
id
16777359
16777357
16777361
16777358
16777360
Thanks,
ward.
declare @test table (id int);
insert into @test select AssignmentID from CI_CIAssignments
select * from @test
exec spUpdateAppDeploymentSummaryByCollection @AssignmentID = 16777359
exec spUpdateAppDeploymentSummaryByCollection @AssignmentID = 16777357
exec spUpdateAppDeploymentSummaryByCollection @AssignmentID = 16777361
exec spUpdateAppDeploymentSummaryByCollection @AssignmentID = 16777358
exec spUpdateAppDeploymentSummaryByCollection @AssignmentID = 16777360
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You can also post here the code of that Stored Procedure so we can find an alternative way to do this.