Tutorial by Examples

This example limits SELECT result to 100 rows. SELECT TOP 100 * FROM table_name; It is also possible to use a variable to specify the number of rows: DECLARE @CountDesiredRows int = 100; SELECT TOP (@CountDesiredRows) * FROM table_name;
This example limits SELECT result to 15 percentage of total row count. SELECT TOP 15 PERCENT * FROM table_name
SQL Server 2012 FETCH is generally more useful for pagination, but can be used as an alternative to TOP: SELECT * FROM table_name ORDER BY 1 OFFSET 0 ROWS FETCH NEXT 50 ROWS ONLY

Page 1 of 1