SQL Server and Table-Valued User-Defined Function optimizations
- by John Leidegren
If I have an UDF that returns a table, with thousands of rows, but I just want a particular row from that rowset, will SQL Server be able to handle this effciently?
SELECT * FROM dbo.MyTableUDF()
WHERE ID = 1
To what extent is the query optimizer capable of reasoning about this type of query?
How are Table-Valued UDFs different from traidtional views if they take no parameters?
Any gotchas I should know about?