Microsoft introduced the APPLY operator in SQL Server 2005. This under-used, non-standard operator can help us solve a number of common (and not-so-common) problems with elegant code which performs well. We will look several problem spaces in which the APPLY operator shines, such as joining to table-valued functions, getting the top N child records for each parent record, string splitting, and word matching. With the use of these examples, we will gain a deeper understanding of when to use the APPLY operator.
On October 14, 2015, Carlos L. Chacon interviewed me for his SQL Data Partners podcast. You can get the recording and show notes on the SQL Data Partners podcast website.
Click here to access the slides for this presentation.
The slides are licensed under Creative Commons Attribution-ShareAlike.
Click here to access demo code for this presentation.
The source code is licensed under the terms offered by the GPL.
I used a number of third-party scripts and examples in this demo, and would like to give credit to the authors once more:
In addition to those references, here are a couple more which helped shape my presentation:
I also have a few blog posts which make use of the APPLY operator. These are mostly on the administrative side, whereas the presentation focused more on the development side.