I can't remember the way to limit the number of rows returned in a select
statement. If you can refresh my memory, thanks!!
Stephany
Stephany
In sql server 7 you can use the top key words
select top 10 * from MyTable order by FieldName
In sql 6.5 you have to use the set rowcount X (where X is the number of
the rows). Of course you can also use it in sql server 7. When you want
to turn the limit off you need to set rowcount to 0.
Adi
Quote:> I can't remember the way to limit the number of rows returned in a select
> statement. If you can refresh my memory, thanks!!
> Stephany
I Can't get top to work in sql server 7.0. Could this syntax be slightly
off?
> select top 10 * from MyTable order by FieldName
> In sql 6.5 you have to use the set rowcount X (where X is the number of
> the rows). Of course you can also use it in sql server 7. When you want
> to turn the limit off you need to set rowcount to 0.
> Adi
> > I can't remember the way to limit the number of rows returned in a
select
> > statement. If you can refresh my memory, thanks!!
> > Stephany
Syntax is correct, but your database may be in 6X compatibility mode ?
Check out sp_dbcmptlevel myDatabase
regards
jensk
> > In sql server 7 you can use the top key words
> > select top 10 * from MyTable order by FieldName
> > In sql 6.5 you have to use the set rowcount X (where X is the number
of
> > the rows). Of course you can also use it in sql server 7. When you
want
> > to turn the limit off you need to set rowcount to 0.
> > Adi
> > > I can't remember the way to limit the number of rows returned in a
> select
> > > statement. If you can refresh my memory, thanks!!
> > > Stephany
Stephany,
SET ROWCOUNT xxx
Or use the TOP command in SQL 7 and above
Neil Pike MVP/MCSE. Protech Computing LtdQuote:> I can't remember the way to limit the number of rows returned in a select
> statement. If you can refresh my memory, thanks!!
> Stephany
1. Newbie-Limiting rows returned in query
Does Oracke offer some way to liit the rows returned in a query? For
instance say I want so select all the rows in a table sorted by name, but
I only want the first ten names. Can I limit to rows 1-10?
Thanks!
http://www.meanmutha.com
2. telnet 1433 - Linus freetds
3. Limiting no of rows return from a query
4. Have you upsized your back end to MS-SQL??
5. Help: SQL Query number of row return limit
6. What's the difference between IBM and Jurassic Park?
7. Limiting amount of rows returned from a query.
8. Oracle question from a SQL Server DBA
9. SQLXML XPath query - how to limit rows returned
10. Limiting number of rows returned by a query
11. Limit number of rows returned by query?
12. limiting number of rows returned in sql query
13. Limiting # rows returned by SQL query - during testing