Using TOP clause in a SELECT statement


 

This article is part of Greg Larsen’s continuing series on Learning T-SQL. To see all 9 items in the series, click here.

TOP Clause Syntax

The syntax for the top clause is simple and is shown in Figure 1.

TOP (<expression>) [PERCENT] [ WITH TIES ]–

Figure 1: Syntax for TOP Clause

Where:

expression – an expression that identifies the number of rows to be returned. The expression equates to a float when the PERCENT option is used, otherwise it equates to a bigint.

PERCENT – When this keyword is included a percentage of rows is returned instead of