How can I make a SQL query and have a parameter the top N value. For example the first person wants to see the top 10 values, the next perhaps the top 50, maybe the top 100. Would I say something like SELECT TOP =@Value from Table?
Thanks
Yes this is for SQL Server. Standard Query, showing everything, but id like to limit the number of rows returned based on input from the user.
SELECT TOP(cast(@N as integer)) COLUMN1 ,Column2 from table1
That works...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With