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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Selecting a number of rows only
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

makimark
Starting Member

34 Posts

Posted - 07/31/2001 :  03:28:10  Show Profile  Reply with Quote


Hi

Does anyone know how to select a certain number of rows only ? Lets say i select a table of 1000 rows but only want to fetch not more than 10 rows from the table, how can i make sure that only 10 are selected ? Now i have confused myself...

Thanks

Merkin
Funky Drop Bear Fearing SQL Dude!

Australia
4970 Posts

Posted - 07/31/2001 :  03:34:40  Show Profile  Visit Merkin's Homepage  Reply with Quote
Don't go confusing your self now

Try


Select top 10 * from myTable




Damian
Go to Top of Page

JustinBigelow
SQL Gigolo

USA
1157 Posts

Posted - 07/31/2001 :  09:16:23  Show Profile  Reply with Quote
There's also set rowcount...

set rowcount 10
go
select...
from...
where...
go
set rowcount 0 -- turns this option off

Justin

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.2 seconds. Powered By: Snitz Forums 2000