I\'m try to create a table-valued function from a query but it gives me error Cannot access temporary tables from within a function. Msg 2772, Level 16, State 1, Procedure f