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
 sql server rownum

Author  Topic 

requestor
Starting Member

17 Posts

Posted - 2007-11-13 : 21:09:42
hai, for one of my batch requirement i would like to retrieve records set by set, meaning if there are 1000 records which satisfies the condtion, i want to take first 100 record process it, and then again go to database retireve another 100 record and so on...
how can i do this...do i need use the for loop logic or, is there any simple way to achieve this? help pls

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2007-11-13 : 21:37:32
Why would you want to do that?

It is far less efficient that doing a full set based operation.

You "can" use a cursor, but that doesn't sound the least bit practical. SQL Server is designed for set based operations.



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-14 : 00:14:37
if you are using SQL Server 2005, use the row_number() function to do it.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-11-14 : 02:54:50
Does it sound pagination?

Madhivanan

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

- Advertisement -