I had a function called dbo.Match.It was an inline TVF that I replaced with a procedure called dbo.Match that has a select statement at its end to select rows from a table so that I can direct the results of select query when I execute dbo.Match to a temporary table called #Temp.
Now if it was a function, I was using this query :
if @MotherFN is not null
begin
SELECT @constVal = FunctionWeight
FROM dbo.FunctionWeights
WHERE FunctionWeights.FunctionId = 20;
INSERT INTO #Temp2
(RowNumber,ValFromUser,ColumnName,ValFromFunc,FuncWeight,percentage)
SELECT RowId,
@MotherFN ,
'mothersfirstname'
,PercentMatch,
@constVal,
PercentMatch * @constVal
FROM dbo.Match(@MotherFN)
end
Now, I need to execute dbo.Match procedure instead of dbo.Match function.How I may make this execution call and insert data in #Temp table like I was doing with function call ?
Problem : Calculating PercentMatch * @constVal and inserting in #Temp in same step efficiently. Procedure dbo.Match would return rowId and PercentMatch only. I need to insert values of RowId and PercentMatch in #Temp along with value of @constVal and a value for result of multiplication of PercentMatch and @constval