JavaScript Editor js editor     Web development 



Main Page

Permanently removes all records marked for deletion in the current table and reduces the size of the table memo (.fpt) file associated with the table.

Note:
You must first open the table exclusively before using the PACK command.

PACK [MEMO | DBF] [Tablename ] [IN nWorkarea | cTableAlias]

Parameters

MEMO


Removes unused space from the memo file but does not remove records marked for deletion from the table. Information in memo fields is stored in an associated table memo (.fpt) file, which as the same file name as the table.
DBF


Removes records marked for deletion from the table but doesn't affect the memo file.
Tablename


Specifies the table to pack. Visual FoxPro opens the specified table, then packs, and closes it.
IN nWorkArea | cTableAlias


Specifies the work area or table alias affected by the PACK command. Use this clause to specify a work area or a table outside the current work area.

Remarks

When you use PACK, Microsoft Visual FoxPro copies all records not marked for deletion to a temporary table. After PACK is finished executing, Visual FoxPro deletes the original table from disk and renames the temporary table with the original table name. If you press the ESC key to cancel PACK, the temporary table is deleted, and the original table remains unchanged. The original table is also recovered if you run out of disk space while PACK is executing.

When you issue PACK without the MEMO and DBF clauses, PACK affects both the table and the memo file.

PACK requires exclusive use of the table. For more information about opening a table exclusively on a network, see SET EXCLUSIVE Command.

If the current table has one or more indexes open, PACK rebuilds the index files.

Caution:
Be careful to mark only records that you no longer need. There is no way to retrieve deleted records after using PACK.

If you omit the IN clause, PACK works in the current work area.

When you use PACK with a table containing autoincrementing fields, the resulting table is not reincremented, that is, existing values are preserved, and gaps exist where deleted records were removed. For more information, see Autoincrementing Field Values in Tables.

If no deleted records exist, PACK does not modify the table or its index.

See Also



JavaScript Editor js editor     Web development