• A two-word answer is: it depends.

    That said, generally, using a multi-statement table valued function lowers your odds for good performance, because the optimizer has no clue about how many rows that function will return, so if this solution is more efficient, it's a bit of luck.

    On the other hand, if you replace the function with an INSERT into a temp table and then use that table in the query, this may be winner, because the temp table has statistics and may help with the next phase. Then again, the temp table means overhead.

    A view is just macro and the only effect of the view is that it makes the query easier to read. Or more difficult.

    [font="Times New Roman"]Erland Sommarskog, SQL Server MVP, www.sommarskog.se[/font]