Command COPY TO Professional
Copies a table to another target table on ADS server.
COPY TO <cFilename> [FOR <cForCondition>] [VIA <cDBE>]
COPY TO allows to copy a table on the ADS server. This will be completely handled and processed remotely which in turn reduces network traffic and is less timeconsuming.
The command COPY TO 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 can be executable on the ADS server. If one of those preconditions can not be fulfilled the COPY TO command will be executed on 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 COPY TO see the Xbase++ Online Documentation.
#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
// copies source table "Test" to "MyBackup"
COPY TO MyBackup FOR Age > 34
// Close databases and disconnect from server.
DbCloseAll()
oSession:disconnect()
RETURN
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.