Pedro Rainho

The important thing is never to stop questioning
posts - 118, comments - 55, trackbacks - 19

Operator Apply

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

Print | posted on Friday, March 28, 2008 7:54 AM

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   

Powered by: