I am having a scenario like this. I need to execute a stored procedure within a SELECT
statement where the input parameters to the calling stored procedure are taken from the table being used in the SELECT
statement. Also, there are multiple function calls as below which use the input from table used in SELECT
clause but for some reason it doesn't work. Here is my code example as below which I am trying to implement.
Code Sample :-
SELECT A,
B,
dbo.storedproc( function1(A,B),
function1(A,B),
function2(B,C),
D
) AS newcol,
D
FROM Table;
Error :-
Msg 4121, Level 16, State 1, Procedure XYZ, Line 34
Cannot find either column "schemaname" or the user-defined function or aggregate "schemaname.dbo.storedproc", or the name is ambiguous.
Note :- I am calling this stored proc for all the rows in the input table by using a set-based approach.