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
 General SQL Server Forums
 New to SQL Server Programming
 Select Top Whatever

Author  Topic 

ConradK
Posting Yak Master

140 Posts

Posted - 2010-06-14 : 11:24:45
So I can select the top 100, is there a way to select the next 100, so I can do what needs be done in chunks?

I suppose i could select top 200 except top 100, but that seems antithetical to what I want to do here, the idea is to break it up to process it in pieces because the table is huge and unmanageable. THANKS!!!!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-06-14 : 12:15:36
If so I can do what needs is an update to the same table then you can go on with top 100 and in the where clause you maybe have the chance to say:
where LastUpdated < '20100614'
for example.

Another way could be to use row_number() so you can address the wanted rows.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2010-06-14 : 13:38:59
You're talking about "paging"

You can use CTE's for this...I think Jeff had a good example somewhere....

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-15 : 02:31:53
Refer point 4
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/multipurpose-row-number-function.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -