Databases Reference
In-Depth Information
This way, we are ensuring an association between the
Origin Airports
table and
any other table containing either a field named
Origin Airport ID
or one named
Origin Airport
. At the same time, we are ensuring that the table doesn't associate
with other tables which contain fields named
Code
or
Description
.
Renaming fields with the Qualify statement
The
Qualify
keyword can be used to qualify field names with their corresponding
table name, which basically renames the specified fields in the form of
tablename.
fieldname
, thus ensuring no unwanted associations are created.
Let's look at our previous example in which we needed to rename the
Code
and
Description
fields. We can rename these fields by using the
Qualify
keyword
as follows:
Qualify Code, Description;
[Origin Airports]:
LOAD
Code,
Description
FROM
[..\Data Files\QVDs\Airport Descriptions.qvd]
(qvd);
The above
Load
statement will result in a table with two fields:
Origin Airports.
Code
and
Origin Airports.Description
.
As you can see, we have specifically entered, as the
Qualify
statement parameter,
the two fields which we want to rename. In some cases, we might need to rename
a long list of fields, making it impractical to list them all in a
Qualify
statement.
Luckily, the
Qualify
statement allows the use of wildcard characters in the
fieldlist
parameter. For example, we can use a star symbol to specify that all
subsequently loaded fields should be qualified. We can also combine the star symbol
with a string or with a question mark symbol (another wildcard character) to specify
that a set of fields that match a given criteria are to be qualified. For instance:
•
Qualify Code, Description;
: This command will only qualify fields
named
Code
or
Description
•
Qualify "*ID";
: This command will qualify all fields whose name
ends with
ID
•
Qualify *;
: This command will qualify all fields that are loaded from
that point forward