Sometimes we do very ugly thing just because of missing simple tricks.
I believe all of the devs who work with sql use SELECT TOP command as they need. This is a very simple sql command.
SELECT TOP 10 * FROM YOURTABLE
Now, sometimes you need to use variable instead of constant number (say 10). If you write the query as