The following example copies the result set from a query on an SQL-based-server to a local DBF file:

d = new Database()

d.databaseName = "SOMESQL"

d.active = true

q = new Query()

q.database = d

q.sql = "select * from SOMETABLE where THIS = 'that' order by ID"

q.active = true

u = new UpdateSet()

u.source = q.rowset

u.destination = "RESULTS.DBF"

u.copy()

This example copies all the rows from the same SQL-based-server table to a local DBF file without using a Query object:

d = new Database()

d.databaseName = "SOMESQL"

d.active = true

u = new UpdateSet()

u.source = ":SOMESQL:SOMETABLE"

u.destination = "SOMEDUP.DBF"

u.copy()

 

When copying more than on copy of a query rowset result, you need to set the rowset cursor to the first row (q.rowset.first) before doing another copy...

 

g = new database()

g.databaseName = "dbasesamples"

g.active = true

 

d = new database()

d.databasename = "dbasecontax"

d.active = true

 

q = new query()

q.database = d

q.sql = 'select * from contacts'

q.active = true

 

u = new updateset()

u.source = q.rowset  

u.destination = ":dbasecontax:contacts_copy.dbf"

u.copy()   //(full table is copied)

 

q.rowset.first() //needed when doing extra copies of the same table

u.destination = ":dbasesamples:contacts2.dbf"

u.copy()   // table is copied