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 |
qwertyjjj
Posting Yak Master
131 Posts |
Posted - 2008-07-22 : 06:31:32
|
Is it possible to select the top number dynamically?DECLARE @a intSET @a = 50SELECT TOP @a * from TABLE ? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-22 : 06:45:49
|
SET ROWCOUNT @aSELECT * FROM TableSET ROWCOUNT 0 E 12°55'05.25"N 56°04'39.16" |
 |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-22 : 06:50:17
|
select TOP(@a) *from yourTableorder by SomeColumnEm |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-22 : 06:55:17
|
Em, this is a SQL Server 2000 forum.What you posted is the preferred way in SQL Server 2005 and later. E 12°55'05.25"N 56°04'39.16" |
 |
|
elancaster
A very urgent SQL Yakette
1208 Posts |
Posted - 2008-07-22 : 07:20:40
|
doh!Em |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-07-22 : 07:36:24
|
Yes!They will make a second Simpsons movie. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|