The other day I had the need to select an exact number of rows in a TSQL stored procedure. The circumstances constrained me in multiple ways and I just so happened to come across this little gem of a trick for selecting a set number of rows without using TOP.
All one must do is use the following assigment:
1 | SET @@ROWCOUNT = # OF ROWS TO SELECT |
Then perform the select statement and your in business!