More on TOP

Last week I wrote about a special case of the TOP operator known as ROWCOUNT TOP.  This week I’ll take a look at some other interesting TOP scenarios.  In general, TOP is a fairly mundane operator.  It simply counts and returns the specified number of rows.  SQL Server 2005 does include two enhancements to TOP…

8

ROWCOUNT Top

If you’ve looked at any insert, update, or delete plans, including those used in some of my posts, you’ve probably noticed that nearly all such plans include a top operator.  For example, the following update statement yields the following plan: CREATE TABLE T (A INT)INSERT T VALUES (0)INSERT T VALUES (1)INSERT T VALUES (2) UPDATE…

8