Difference between revisions of "COPY DATABASE"

From Lianjapedia
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
==See Also==
 
==See Also==
[[ADATABASES()]], [[ADD TABLE]], [[ALTER INDEX]], [[ALTER TABLE]], [[BACKUP DATABASE]], [[CLOSE DATABASES]], [[CLOSE TABLES]], [[COMPILE DATABASE]], [[CREATE DATABASE]], [[CREATE INDEX]], [[CREATE TABLE]], [[CREATE VIEW]], [[DATABASE()]], [[DB_DATADIR]], [[DBUSED()]], [[DISPLAY DATABASE]], [[DISPLAY INDEXES]], [[DISPLAY SCHEMAS]], [[DISPLAY TABLES]], [[DROP DATABASE]], [[DROP INDEX]], [[DROP TABLE]], [[GETENV()]], [[LIST DATABASE]], [[LIST INDEXES]], [[LIST SCHEMAS]], [[LIST TABLES]], [[OPEN DATABASE]], [[PACK DATABASE]], [[REBUILD DATABASE]], [[REINDEX DATABASE]], [[RESTORE DATABASE]], [[SET AUTOCATALOG]], [[SET EXCLUSIVE]], [[SQL USE|USE]]
+
[[ADATABASES()]], [[ADD TABLE]], [[ALTER INDEX]], [[ALTER TABLE]], [[CLOSE DATABASES]], [[CLOSE TABLES]], [[COMPILE DATABASE]], [[CREATE DATABASE]], [[CREATE INDEX]], [[CREATE TABLE]], [[CREATE VIEW]], [[DATABASE()]], [[DBUSED()]], [[DISPLAY DATABASE]], [[DISPLAY INDEXES]], [[DISPLAY SCHEMAS]], [[DISPLAY TABLES]], [[DROP DATABASE]], [[DROP INDEX]], [[DROP TABLE]], [[GETENV()]], [[LIST DATABASE]], [[LIST INDEXES]], [[LIST SCHEMAS]], [[LIST TABLES]], [[OPEN DATABASE]], [[PACK DATABASE]], [[REBUILD DATABASE]], [[REINDEX DATABASE]], [[SET AUTOCATALOG]], [[SET EXCLUSIVE]], [[SQL USE|USE]]
  
 
==Description==
 
==Description==
 
The COPY DATABASE command is used to copy an existing database to a new database.  By default an error will be returned if the target database already exists.  Specifying the optional IF NOT EXISTS keywords no error will be returned if the target database already exists.  If the optional IF EXISTS keywords are specified and the target database already exists, then it will be removed before the copy.  Both the databases must be closed before they can be copied.
 
The COPY DATABASE command is used to copy an existing database to a new database.  By default an error will be returned if the target database already exists.  Specifying the optional IF NOT EXISTS keywords no error will be returned if the target database already exists.  If the optional IF EXISTS keywords are specified and the target database already exists, then it will be removed before the copy.  Both the databases must be closed before they can be copied.
 
Databases in Lianja are implemented as directories containing files that correspond to the tables and associated files in the database.  Operating System file protection can be applied individually to the files for added security.  The directories are sub-directories of the Lianja data directory.  The environment variable DB_DATADIR points to the current Lianja data directory and can be queried using the GETENV() function.  Files from other directories can be added to the database using the ADD TABLE command or via the database catalog and SET AUTOCATALOG functionality.
 
  
 
==Example==
 
==Example==
Line 23: Line 21:
 
[[Category:Commands]]
 
[[Category:Commands]]
 
[[Category:Databases]]
 
[[Category:Databases]]
[[Category:Databases Commands]]
 
 
[[Category:Lianja VFP Extensions]]
 
[[Category:Lianja VFP Extensions]]
 
[[Category:VFP Command Extensions]]
 
[[Category:VFP Command Extensions]]

Latest revision as of 10:39, 21 December 2012

Purpose

Copies the specified database to a new database

Syntax

COPY DATABASE <database name1> TO <database name2> [IF [NOT] EXISTS]

See Also

ADATABASES(), ADD TABLE, ALTER INDEX, ALTER TABLE, CLOSE DATABASES, CLOSE TABLES, COMPILE DATABASE, CREATE DATABASE, CREATE INDEX, CREATE TABLE, CREATE VIEW, DATABASE(), DBUSED(), DISPLAY DATABASE, DISPLAY INDEXES, DISPLAY SCHEMAS, DISPLAY TABLES, DROP DATABASE, DROP INDEX, DROP TABLE, GETENV(), LIST DATABASE, LIST INDEXES, LIST SCHEMAS, LIST TABLES, OPEN DATABASE, PACK DATABASE, REBUILD DATABASE, REINDEX DATABASE, SET AUTOCATALOG, SET EXCLUSIVE, USE

Description

The COPY DATABASE command is used to copy an existing database to a new database. By default an error will be returned if the target database already exists. Specifying the optional IF NOT EXISTS keywords no error will be returned if the target database already exists. If the optional IF EXISTS keywords are specified and the target database already exists, then it will be removed before the copy. Both the databases must be closed before they can be copied.

Example

copy database southwind to temp if exists