Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL in batches of 100
Message
From
13/02/2009 18:39:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
13/02/2009 16:21:30
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01381657
Message ID:
01381679
Views:
58
>Let's say I have a table with 950 records. I want to select the first 100, do something, the next 100, do something, etc., then select the final 50, do something. It is the same something, I just only want to process 100 at a time.

lastValue = 0

select top 100 * from yourTable where yourPrimaryKey > m.lastValue order by yourPrimaryKey
* ...
* and assign max primaryKey in this set to lastValue

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform