First, I'm not sure why it has to be an UDF. Can you use stored procedure instead?
Second, mosy likely you can replace a temp table with a table variable. It'll work in UDF.
>
>I use a code from the internet that calculate the amortization of a loan and is working fine. Now the designer want a report that produce the same results. Logically I will use the same code and twik to fullfill the report request. But the SQL Consultant does not want the same code in diferent places. As a programmer the logic said make a function but the function in SQL does not allow insert,update or delete and my procedure work creating a temp table and insert the values created for the live of the loan. How I can acomplish that mantaining only one set of code. Like calling that store procedure that return just a table with the amortization values and merge with the other table that have the owner information.
--sb--