See Also: Erasefile
To erase all data from a database table, leaving the empty table definition in place.
zerofile table
Zerofile erases all data from table (provided it is open) while maintaining the table definition unchanged. After a zerofile command, the number of records in table is zero.
zerofile customer
In this example, all record data in Database table customer is deleted. The table definition of customer remains intact for future use.
Once a zerofile command has been executed, the only way to restore the data is from a backup copy of the table.
Be extremely careful in using this command. It is very powerful, and if used improperly could destroy valuable data.
You should never use the zerofile command in a multi-user situation, when another user may have the same table open. Doing so could result in a corrupted table.
Zerofile is useful in removing experimental or sample data from database tables, and for reinitializing a database for a new period. However, because it erases all data, zerofile does not allow balances to be carried forward to the next period in table, nor any other data. Again, use the command with care.
Where you wish to actually delete a disk file, use the erasefile command. Zerofile merely removes all data from a database table, rather than erasing disk files.
You can pass the table's logical name or table number (in the filelist) to the zerofile command.
This command should not be used within a transaction; it will cause an error. A transaction starts with a begin_transaction command and ends with end_transaction.