Print Page | Close Window

Form a query using TOP and fetch next Rec

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Database Discussion
Forum Description: Discussion and chat on database related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=7874
Printed Date: 29 March 2026 at 6:02am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Form a query using TOP and fetch next Rec
Posted By: ravi_zee
Subject: Form a query using TOP and fetch next Rec
Date Posted: 05 December 2003 at 5:48am

Hi,
I have an INI file, contans a field with "RestrictedRead =100"
I am reading the INI file in my Java code and getting this restrictd value and building a query dynamically for further processsing as...

sSQL = sSQL + " TOP " + getRestrictReadValue() + " ";

PROBLEM

If I have 10000 records to be processed, as of now it is reading only 100 records.But I want after 100 records completed it should fetch next 100 and continue till EOF(10000) records...

Can anyone help me how to succeed this and how to form a query for this scenario.

Matter very urgent

Cheers
Ravi




Replies:
Posted By: michael
Date Posted: 05 December 2003 at 7:26am
You cannot use top then, you use either a  SQL Side Cursor or you use ado paging. If you use top you only get your 100 records and you cannot go further. So depending on the architecture your are using, i would go with a cursor.

-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net