RDD

DbCopyStruct()

Create an empty file from the current table structure

Syntax

Signature
DbCopyStruct( cFile, [aFields] ) --> lSuccess

Arguments

cFile

Destination database file.

aFields

Optional list of fields to include.

Return value

.T. when the file is created successfully; otherwise .F..

Description

DbCopyStruct() copies the structure of the current work area into a new, empty database file. Records are never copied.

Notes

The current work area remains open and unchanged.

Example

DbCopyStruct.prg
PROCEDURE Main()

   DbCreate( "copy_struct_source.dbf", { { "NAME", "C", 12, 0 }, { "AGE", "N", 3, 0 } } )
   DbUseArea( .T., , "copy_struct_source.dbf", "People" )
   QOut( "Structure copied: " + IIF( DbCopyStruct( "people_empty.dbf" ), "YES", "NO" ) )
   DbCloseArea()
   FErase( "copy_struct_source.dbf" )
   FErase( "people_empty.dbf" )


   RETURN

Output

See also