Mark,
I wonder whether your solution might not share the same problem as some of the other solutions proposed, for a large table, namely speed. In other words, VFP will be forced to evaluate the condition for each and every record. Perhaps VFP will actually retrieve each and every record, and only then evaluate the condition.
Of course, speed may actually not be a critical concern, since usually you won't need to create sample data every day - only once.
>>Hi everybody,
>>
>>How can I randomly select n (110) codes from some huge table, so these codes would be unique? I'm trying to create a test case now...
>
>You could determine the total number of records in the table, and from that determine the percentage needed to get the number of records you want. Then try:
>
>select * from MyTable having rand() < lnPct
>
>where lnPct is something like 0.05 for 5 percent. This will not be exact because rand() may not return enough values below lnPct to get the number of records you want.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)