In SQL Server 2005 and later, TOP can be parameterized:
Code:
DECLARE @maxRecords INT = 5
SELECT TOP (@maxRecords) * FROM YourTable
returns the first 5 records from the table urTable. To give more meaning to TOP, you may want to add an ORDER BY clause.
Cheers,
Imar