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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 select 1000 rows

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-12-29 : 12:10:39
karthik writes "Hi,
Iam writing a procedure that uses a cursor the cursor selects the data from a huge table of 9 million rows. what i want to do is that to select 10000 rows at a time based on a unique identity column using 'between' clause.
After the cursor has completed the fetch it has to automatically
get the next 10000

could u please help me to solve this

thanks and regards

karthik"

skillile
Posting Yak Master

208 Posts

Posted - 2001-12-29 : 13:33:01
what is the cursor doing and why do you need it?

Can you use

select top 1000 * from table where @uniqueid between x and y or:

use a paging function and place the next 1000 in a table variable
each time, much more efficient.



slow down to move faster...
Go to Top of Page

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2001-12-30 : 03:01:28
You also might want to read this article: What's After Top. However, I would STRONGLY encourage you to look into abandoning your cursor. In fact, we have many people here who take particulary joy in helping people find set-based solutions to replace cursors, so if you'd like to tell us what you're doing or post your code, we might be able to give you much better performance than you've got right now.

--------------------------------------------------------------
1000 Posts, Here I come! I wonder what my new title will be...
Go to Top of Page
   

- Advertisement -