Conclusion

As you probably realized from this chapter, TOP and APPLY are two features that complement each other in many ways. Remember that the SET ROWCOUNT option is a legacy feature and is supported in SQL Server only for purposes of backward compatibility. It is a good idea to replace all references to SET ROWCOUNT with the TOP option. Compared to the alternatives, the APPLY operator allows for very simple and fast queries whenever you need to apply a table expression to each row of an outer query.

Get Inside Microsoft® SQL Server® 2008: T-SQL Querying now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.