Hi Dear,

If you are using MySQL then use the following query.

"select * from abc limit 0,100"

this will give you only first 100 records.

Regards,
Deepak Kumar


--- Bhushan Bhangale <[EMAIL PROTECTED]> wrote:
> Select * from tablename where rownum < 101 will give
> you the desired result.
>
> The 'top' fundaa works in access database only i
> guess.
>
> > -----Original Message-----
>
> > Change your query to "Select top 100 * from ..."
> returns the first 100
> > records.
>
> > -----Original Message-----
> > From: List Resident
> [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, January 02, 2001 3:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: How to set resultSet size
> >
> >
> > Content-Type: text/plain; charset=us-ascii;
> format=flowed
> > Content-Transfer-Encoding: 7bit
> >
> > "S. Chen" wrote:
> >  >
> >  > String query = "select * from table1 order by
> trans_date desc";
> >  > [...]
> >  > while (rs.next()&& count <100) {
> >  > [...]
> >  >
> >  > The problem is soon enough there will be over
> 10,000
> >  > transactions in the database.  If I do it this
> way, it will be
> >  > not efficient.  so I want to use the method
> setFetchSize(100).
> >
> > This isn't inefficient on most databases. You've
> paid the price
> > of the ORDER BY clause, and for most real DBMSes
> the code you
> > have is fine.
> >
> > Also, setFetchSize has very little to do with
> this. The fetch
> > size is just an internal performance hint to the
> JDBC driver, and
> > should not be set based on application
> requirements. The prefetch
> > row count should be based on row size, packet
> size, network
> > congestion, etc.
> >
> > More relevant, perhaps, is setMaxRows, if your
> driver supports
> > it, or SQL equivalents. You should be warned,
> though, that
> > limiting the number of rows returned from a query
> with an ORDER
> > BY clause may not work. In Oracle, for example,
> the limiting is
> > done *before* the sorting. You can check your DBMS
> documentation
> > to see if it supports any performance enhancements
> for limiting
> > result set size that behave properly with ORDER
> BY, or
> > investigate other database-specific tuning, if
> really necessary.
> > Like most performance enhancements, it probably
> isn't.
> >
> > John L
> >
> >
>
==============================================================
> > =============
> > To unsubscribe: mailto [EMAIL PROTECTED] with
> body:
> > "signoff JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with
> body: "set
> > JSP-INTEREST DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found
> at:
> >
> >  http://java.sun.com/products/jsp/faq.html
> >  http://www.esperanto.org.nz/jsp/jspfaq.html
> >
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
> Thanks & Regards
> Bhushan Bhangale
> Consultant
> http://www.netacross.com
> Chequemail.com - a free web based e-mail service
> that also pays!!!
> http://www.chequemail.com
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with
> body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body:
> "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.html
>  http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
>
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets


__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to