Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - copy to copy records to another database file http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 copy to             Copy records to another database file
------------------------------------------------------------------------------
 Syntax
   [!sAlias] copy to cTarget [scope] [while lExp] [for lExp]

 Arguments
   sAlias is the database to copy from.
   cTarget is the name of the database file to copy to.
   scope specifies a portion of the source database.
   lExp is a logical expression.

 Description
   The copy to command copies records to the database file specified by
   cTarget.

   copy to copies all fields in the current alias into the specified
   database. An implied build is performed using the selected alias to
   create the new database. In case that a database with the specified name
   already exists, it will be overwritten without any warning.

   copy to can be used to sort a database when the selected alias is indexed
   because in that case the records are copied in the index order of the
   source datbase file.

   The default scope of copy to is all.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   proc Test_copyto
   open sTest                  // open source database
   // create a sub-database for all people called Jennifer
   copy to "copy.dbf" for sTest->firstname = "Jennifer"
   close sTest
   open "copy.dbf" alias sTest // open copied database with same alias
   ? "There are", istr( areccount( sTest ) ), "Jennifers"
   close sTest
   erase "copy.dbf"
   endproc

   proc main
   Test_copyto()
   endproc

See Also: Database command scope table append from copy file

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson