Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How to use a variable @N in the SELECT TOP N statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-04-09 : 22:43:15
Saúl writes "I need to make some select statements to gather the first N rows using the SELECT TOP N statement. The problem is that I don't have a fixed number of rows to gather, the users can choose a specified number, and I have to use a full of IF statements procedure to accomplish this feature. I thought I could use a variable instead an integer constant but it didn't work. Is there any way to make this N a variable expression?

Im using SQL server 2000 on Windows 2000.
Thanks For your Help, I hope you have an answer.

Regards.

Saul Ollervides."
   

- Advertisement -