I am struggling with getting the result back for a dynamic query that is being called from a different stored procedures. Here is what I am trying to achieve.
Procedure A:
CREATE PROCEDURE A
@C1 int, @F1 int
AS
SET @SQL = 'SELECT ID FROM EMPLOYEE_TABLE WHERE '+@C1+' = +'@F1'
EXEC(@SQL)
Procedure B:
CREATE PROCEDURE B
@C1 int, @F1 int
AS
DECLARE @Result INT
EXEC @Result = A @C1, @F1
I need to run stored procedure B and let it return back to me the result. I just cannot seem to get the correct result back. How can I fix this problem?