Limit Result Set

Download sql-server eBook

Introduction

As database tables grow, it's often useful to limit the results of queries to a fixed number or percentage. This can be achieved using SQL Server's TOP keyword or OFFSET FETCH clause.

Parameters

ParameterDetails
TOPLimiting keyword. Use with a number.
PERCENTPercentage keyword. Comes after TOP and limiting number.

Remarks

If ORDER BY clause is used, limiting applies to the ordered result set.

Related Examples

Stats

94 Contributors: 4
Friday, February 17, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook