I have a Multistatement Table-valued Function with mainly 3 selects in it.
The 3 selects statements from the function, executed separatly take about 1.5'; if I want execute the function, it takes over 11' !!!!!
I attach 3 files, one with the function, one with the function's query and the last with the execution plan of the main thread of the query; obviosly the execution plans of the function's query differs from the call of the function; more, the plan of the later shows only the call not the execution of function.
I forget to put the call of the function, which is simple
select * from fstocadhoc2(20080525)