>>I'm going to give that a try. I like this approach, as defining the gaps is my desired result. Unfortunately, this is the smallest of 8 tables that I need to look at.
>>
>>>Hmm, too bad. I never had to run it on more than about 40K records and worked fine there. Could you process the main file in smaller chunks?
>
>Maybe this would work better, plain old xbase style code:
>
>
>CREATE CURSOR gaps (gapstart i, gapend i)
>SELECT sequence
>GO TOP
>nstart = nval - 1
>nend = nstart
>SCAN ALL
> IF nstart+1=nval
> nstart = nval
> LOOP
> ENDIF
> IF nstart<nval
> nstart = nstart + 1
> nend = nval - 1
> ENDIF
> INSERT INTO gaps VALUES (nstart,nend)
> nstart = nval
>ENDSCAN
>
>
>40K records takes about .08 seconds.
>400K takes about .67 seconds.
Perfect. 2 seconds here.