Reducing
the Data Extracted
Do you ever wish to extract
data from one database into another, but the source database is too
large to extract every record? Perhaps you wish to use your live
database and copy it into a local Solid database for testing
purpose?
But the data is too big for your Solid
database, or would take too long.
One answer could be to select certain areas of
data, i.e. a reduced amount of data from each table.
When copying data using the
/cpy statement
you can use a where clause.
e.g.
/whr="client_ref_no<200" /cpy
def:client.modelname c:\client.trx
The above will copy all of the
records into the trx file where the client_ref_no is less than 200.
The format of the
/whr=
statement is as follows:
{/whr=whr} /cpy source target {mapfile}
Remember the source, target and
mapfile parameters are positional, the /whr= used with /cpy
must be placed before the /cpy switch itself.
/whr=
Use the
/whr= switch
to select the occurrences that will be copied from source to target.
/whr="select1{;select2; ....;selectn}"
Separate the select clauses with
semicolons. And no spaces are allowed inside the select causes.
One note to point out is that
/whr=
statement can not be used when
the source file is a trx format. This command can only be used when
the source (in this case DEF), is a database source. You cannot use
it for example, when the source is TRX.
Note that the where clause would appear to get
translated into a UNIFACE u_where clause, so database specific
queries such as ‘rownum < 100’ cannot be used?
|