SQL Server Forums
Profile | Register | 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
 New Topic  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  
 New 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.28 seconds. Powered By: Snitz Forums 2000