Say I've got stored proc 1, that returns some data. how can I execute that stored proc and set some parameters within another stored proc based on the results of that stored proc.
For example: Table:
UserInfo (UserID [int], Name [varchar], DateOfBirth [datetime] )
Stored Proc 1:
CREATE Procedure StoredProc1
@Name [varchar]
AS
SELECT UserID, Name, DateOfBirth FROM UserInfo WHERE Name = @Name
Stored 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 that is what I want to do, set the count based on the last set of results.
I can't modify stored proc 1