xHarbour Reference Documentation > Command Reference xHarbour Developers Network  

COPY STRUCTURE

Copies the current database structure to a new database file.

Syntax

COPY STRUCTURE [FIELDS <fieldNames,...>] ;
            TO <cDatabase>

Arguments

FIELDS <fieldNames>
A comma separated list of literal field names, or character expressions enclosed in parentheses, specifies the database fields of the current work area to be included in the new database file. When no fields are specified, all fields are included.
TO <cDatabase>
This is the name of the database file to create. It can include path and file extension. When no path is given, the file is created in the current directory. The default file extension is DBF. <cDatabase> can be specified as a literal file name or as a character expression enclosed in parentheses.

Description

COPY STRUCTURE is a database command used for creating an empty database file based on the field definitions of the current work area. All fields of the current work area are used for the new database unless a list of field names is provided.

Should <cDatabase> already exist, it will be overwritten without warning.

Info

See also:APPEND FROM, COPY STRUCTURE EXTENDED, CREATE, DbAppend(), DbCopyStruct(), DbCopyExtStruct(), DbCreate()
Category: Database commands
Source:rtl\dbstrux.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example demonstrates a technique for creating a subset of records
// in a temporary database file.

   PROCEDURE Main
      USE Address NEW
      COPY STRUCTURE TO Temp

      USE Temp
      APPEND FROM Address FOR Trim(Upper(Address->City)) = "LONDON"

      < database operations with temporary file >

      CLOSE Temp
      ERASE Temp.dbf
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe