To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-22-2002, 01:20 PM
sewun sewun is offline
Junior Member
 
Join Date: Oct 2002
Location: china
Posts: 2
Question about the cursor

Please give me the answer.
(The requirement: fetch 1000 rows)
I don't know whether the 'DECLARE CURSOR' statement supply a parameter to define the '1000' or not.
Reply With Quote
  #2  
Old 11-14-2002, 03:08 PM
sqlhead sqlhead is offline
Junior Member
 
Join Date: Oct 2002
Posts: 1
is it possable for you to do record count and then set up a for loop with a count up to 1000 every time the cursor is executed add 1 to the count.
Reply With Quote
  #3  
Old 11-14-2002, 09:07 PM
sewun sewun is offline
Junior Member
 
Join Date: Oct 2002
Location: china
Posts: 2
Smile thanks

Thank you for your reply.But this is not the answer that I want! I just need to avoid the loop!
Reply With Quote
  #4  
Old 11-18-2002, 07:09 PM
bamcorp bamcorp is offline
Junior Member
 
Join Date: Nov 2002
Posts: 8
If you simply want to retrieve 1000 rows try using :

select top 1000 field_name
from table_name
order by your_criteria

But if you actually want to pass 1000 rows through a cursor you could create an incrementing variable and stop the cursor when it reaches 1000.
Reply With Quote
  #5  
Old 11-26-2002, 01:33 PM
sjimmo sjimmo is offline
Junior Member
 
Join Date: Nov 2002
Location: Chicopee, MA
Posts: 12
Fetch 1000 rows

You should be able to limit the number of rows returned by issueing the following prior to your select statement:

SET ROWCOUNT 1000

This will return only 1000 rows.
Reply With Quote
Reply Post New Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 11:45 PM.


DatabaseJournal Recent Articles


 » Grouping with SQL Server 2008

 » Conducting Service Broker Conversation Usi...

 » SQL Server Consolidation Initiative Under ...

 » Transaction Log Growth, do you need it?

 » New FileMaker Pro 10 Ships With Sleek New ...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.