SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Stored Procedure to SELECT NEXT x TOP y Records

By João Melo,

This stored procedure implements a kind of SELECT NEXT x TOP y Columns FROM Table WHERE Condition ORDER BY Order. It works on any table that has a unique id column and it works with any WHERE clause and any ORDER BY condition. The only drawback is its very poor performance on large tables. This is my first attempt to build a generic NEXT x TOP y solution so I would really welcome some comments and tips. João Melo (joao.melo@inga.min-agricultura.pt)

Total article views: 1209 | Views in the last 30 days: 2