Command APPEND FROM Professional

Appends records from a source table into the current workarea

Syntax
APPEND FROM <cSourceTableName> [FOR <cForCondition>] [VIA <cDBE>]
Parameters
<cSourceTableName>
<cSourceTableName> specifies the name of a table which should be imported into the current workarea. It can be specified either as a literal file name or a character expression in parentheses. If the file name is specified without a file extension, the default extension predetermined by the ADSDBE is used.

if a path has been specified the path has to be visible from the ADS server's point of view. The complete operation will be handled by the ADS server.

<cForCondition>
<cForCondition> is an optional logical expression defining a condition. Only records of the source table for which <cForCondition> returns the value .T. (true) will be appended.
<cDBE>
<cDBE> optionally specifies the database engine (DBE) used to manage the files in the desired workarea. It is a character string containing the name of the DBE. If <cDBE> is not specified, the DBE defined as the default with DbeSetDefault() is used. If the option SDF or DELIMITED is specified, or <cDBE> does not refer to ADSDBE, the Xbase++ native APPEND FROM implementation is used.
Description

The function appends the content of the specified table to the current selected workarea. The source table has to exist.

The command APPEND FROM will be entirely processed on the ADS server. This makes it necessary that both, source and target table, must be ADS driven tables and the FOR condition must be executable by the ADS server. If one of those preconditions can not be fulfilled, the APPEND FROM command will be executed by the client (see \SOURCE\SYS\DBBULK.PRG). The same applies if options like REST, WHILE or ALL as supported by Xbase++ are used. This is because the ADS server does not provide such a functionality. For more details about APPEND FROM see the Xbase++ Online Documentation.

The structure of both - the source and target table - must be exactly identical or the append will fail and a runtime error will be raised.

Examples
#include "ads.ch" 
#include "adsdbe.ch" 


// Load ADSDBE as default database engine. 
PROCEDURE DbeSys 
   IF !DbeLoad( "ADSDBE" ) 
      Alert( "ADSDBE could not be loaded!" ) 
   ENDIF 
   DbeSetDefault( "ADSDBE" ) 
RETURN 


PROCEDURE Main 
   // Connect to database server. 
   LOCAL cConnect := "DBE=ADSDBE;SERVER=\\ALASKA\VOL1" 
   LOCAL oSession := DacSession():new( cConnect ) 

   IF !oSession:isConnected() 
      Alert( "Connection to server could not be established!" ) 
      QUIT 
   ENDIF 

   // open table on ADS server 
   USE Test NEW SHARED 

   // appends all records matching the FOR condition to 
   // the current workarea. 
   APPEND FROM MyBackup FOR Age < 20 

   // Close databases and disconnect from server. 
   DbCloseAll() 
   oSession:disconnect() 
RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.