It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes How to retrieve partial data in SQL Server ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "How to retrieve partial data in SQL Server ?" Watch "How to retrieve partial data in SQL Server ?" New topic

How to retrieve partial data in SQL Server ?

samit majumdar

Joined: Jun 09, 2004
Posts: 11
I am trying to display 4 columns of a particular table. The browser

is displaying 50 records per page. 'Next' and 'Previous' buttons are

there for navigating through all the records. It may have even 1

million or more records. The table may have n number of records. I am

not getting any problem if the record size is approximately 50,000.

But for large number of records say, 1 lac or more, the browser is

taking too much time...roughly, for 1 lac record it is taking 35

seconds and for 2.5 lac record it is taking 4 the no of

records fetched loading time also increases

exponentially. So, my aim is to collect partial data from the table

and display it. In oracle I can manage it using rownum and minus

clause, efficiently. But in SQL Server I am not able to handle it,

using those technique. My application runs both on Oracle and SQL

Server. Can anybody help me?

For more clarity :::: I want to collect 1 to 50 records from the

table. next time I want to collect records from 51th. position to

100th. position. And then from 101th. position to 15oth. and so on.
Of course in SQL Server.

I am writing my code in JSP.

Thanks -

[ July 21, 2005: Message edited by: samit majumdar ]
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Here are some notes on prior pagination discussions. See if any of these ideas fit your situation. Let us know if you think of better ones!

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ganesh Gowtham
Ranch Hand

Joined: Mar 30, 2005
Posts: 225

if i want to develop the list which shows only 10 records at a time but the table may have 50,000 qualifiing
records for my query ..i have to naigaet using the prev and fwd buttons what is the best way to do....
i tried setFetcsize(num); but in vain...
is there any link that i can use it for iterate the resultset (10 records at a time) ,
i stored the romnum in session for each fwd button i increased by "10" and send to database is this
way appreciatable..
Pls suggest

Thanks, Ganesh Gowtham
I agree. Here's the link:
subject: How to retrieve partial data in SQL Server ?
It's not a secret anymore!