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)
 Using the command select TOP X ....

Author  Topic 

jraha
Starting Member

16 Posts

Posted - 2001-04-16 : 16:17:53
why can't I replace the number following TOP with a variable?

I find myself always trying to do something like this and never being able to.

select top 10 col1, col2 from tTable

declare @numRowsWanted int
set @numRowsWanted = 99
select top @numRowsWanted col1, col2, from tTable

   

- Advertisement -