Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Limiting the found set
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00527254
Message ID:
00527851
Views:
30
>>> The one thing to watch for is that in order to get the last
>>> 10 rows of the table, you have to get the entire table and
>>> you're right about SQL Server not allowing a parameterized
>>> TOP clause. This means that you have to use Dynamic SQL
>>> and probably some logic to switch things around once
>>> you've passed the mid-point of the table.

I'd thought about that (the switching at mid-point) for a project I've been working on, but then I'd have to know the record total of your expected result set. And in my particular case, I really wouldn't know. For this purpose, the folks I work with are okay with "this process gets slower as you move further down the list."

The dynamic SQL is more troubling to me, performance wise, but c'est la vie. For now at least.

Overall, though, I have to admit that I've really just begun to unlock the potential power of derived tables, and it is changing the way that I think about grabbing and using data (not just in this case, but overall)....
The whole problem with the world is that fools and fanatics are always so certain of themselves, but wiser people so full of doubts. - Bertrand Russell
Previous
Reply
Map
View

Click here to load this message in the networking platform