Copies data from the currently selected table to an array.

COPY TO ARRAY ArrayName   
   [FIELDS FieldList | FIELDS LIKE Skeleton | FIELDS EXCEPT Skeleton]
   [Scope] [FOR lExpression1] [WHILE lExpression2] [NOOPTIMIZE]



Specifies the array to which data from the table is copied.

FIELDS FieldList

Specifies that only the fields specified in FieldList are copied to the array. If you omit FIELDS FieldList, all fields are copied to the array if the array has enough columns.


Specifies that fields that match the field skeleton Skeleton are copied to the array.


Specifies that all fields except those that match the field skeleton Skeleton are copied to the array.


Specifies a range of records copied to the array. Only the records within the range are copied. The scope clauses are: ALL, NEXT nRecords, RECORD nRecordNumber, and REST. For more information on scope clauses, see the Scope Clauses online topic.

FOR lExpression1

Specifies that only the records that satisfy the logical condition lExpression1 are copied to the array. To conditionally copy records to the array, include the FOR clause to filter out undesired records.

WHILE lExpression2

Specifies a condition where records are copied to the array while the logical expression lExpression2 evaluates to True (.T.).


Disables Rushmore Query Optimization of COPY TO ARRAY. For more information, see SET OPTIMIZE Command and Using Rushmore Query Optimization to Speed Data Access.

Expand imageRemarks

Expand imageExample

Expand imageSee Also