Say I saved proc 1, which returns some data. how can I execute this stored proc and set some parameters in another stored procedure based on the results of this stored procedure.
For example: Table:
UserInfo (UserID [int], Name [varchar], DateOfBirth [datetime] )
Saved Proc 1:
CREATE Procedure StoredProc1
@Name [varchar]
AS
SELECT UserID, Name, DateOfBirth FROM UserInfo WHERE Name = @Name
Saved Proc 2:
CREATE Procedure StoredProc2
@AmountOfNames [int] OUT
SELECT @AmountOfNames=COUNT(EXEC StoredProc1 @Name='Irwin')
I know that Stored Proc 2 is not how it should be built, but this is what I want to do, set the score based on the last set of results.
I cannot change saved proc 1
Irwin source
share