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.
Author |
Topic |
luke nukem
Starting Member
5 Posts |
Posted - 2007-07-30 : 09:06:53
|
I know I can use "First" to specify a number of rows to return from a query but is it possible for the number of rows returned to be based on a parameter, something like this:SELECT FIRST @someNumber name, ageFROM friendsWHERE age > @ageInput |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-07-30 : 09:11:38
|
SELECT TOP (@SomeNumber) Name, AgeFROM FriendsWHERE Age >= @AgeInput E 12°55'05.25"N 56°04'39.16" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-30 : 10:13:48
|
Also using ORDER BY clause will make it more sense MadhivananFailing to plan is Planning to fail |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-07-30 : 10:15:32
|
If you use SQL Server 2000 then use SET ROWCOUNT @SomeNumberquerySET ROWCOUNT 0MadhivananFailing to plan is Planning to fail |
|
|
|
|
|