The APPLY operator, only available in SQL Server 2005, allows the invocation of a table-valued function for each row returned by an outer table expression of a query.
It's like join without using the "ON". The join is between a 2 tables and the apply operator is between a table and a function
The APPLY operator can be CROSS APPLY and OUTER APPLY.
- CROSS APPLY returns only rows from the outer table that produce a result set from the table-valued function.
- OUTER APPLY returns both rows that produce a result set, and rows that do not, with NULL values in the columns produced by the table-valued function.
Ex:
SELECT T.*, F.*
FROM MyTable AS T
CROSS APPLY MyFunction(T.id) AS F