Specifies which fields in a table can be accessed. There are two versions of the syntax.
SET FIELDS ON | OFF | LOCAL | GLOBAL |
SET FIELDS TO [[FieldName1 [, FieldName2 ...]] | ALL [LIKE Skeleton | EXCEPT Skeleton]] |
Parameters
- ON
- Specifies that only the fields in the field list can be accessed.
- OFF
- (Default) Specifies that all the fields in the current table can be accessed.
- LOCAL
- Specifies that only the fields in the current work area listed in the fields list can be accessed.
- GLOBAL
- Specifies that all fields in the field list, including fields in other work areas, can be accessed. SET FIELDS GLOBAL lets you access fields in other work areas without issuing SET COMPATIBLE TO DB4.
- TO [ FieldName1[, FieldName2...]]
-
Specifies the names of fields that can be accessed in the current table. You must include an alias with the field name in the following cases:
-
When the field is in a table that is open in a work area other than the currently selected work area.
-
When the field names are the same in two or more tables.
This example creates a calculated field called LOCATION:В Copy Code <calculated field name> = <expr>
CITY and STATE are the names of fields from the selected table.В Copy Code CLOSE DATABASES USE customer SET FIELDS TO LOCATION = ALLTRIM(city) + ', ' + state
-
When the field is in a table that is open in a work area other than the currently selected work area.
- ALL
- Allows access to all the fields in the current table.
- ALL LIKE Skeleton| EXCEPT Skeleton
-
You can selectively access fields by including the LIKE or EXCEPT clause or both. If you include LIKE Skeleton, you can access fields that match Skeleton. If you include EXCEPT Skeleton, you can access all fields except those that match Skeleton.
The skeleton Skeleton supports wildcards such as * and ?. For example, to access fields that begin with the letters A and P, issue the following:
The LIKE clause can be combined with the EXCEPT clause:
В Copy Code SET FIELDS TO ALL LIKE A*,P*
В Copy Code SET FIELDS TO ALL LIKE A*,P* EXCEPT PARTNO*
Remarks
SET FIELDS TO is additive — issuing SET FIELDS TO with a field list adds the specified fields to those that are currently accessible.
Issuing SET FIELDS TO implicitly performs SET FIELDS ON. Issue SET FIELDS TO without including either a field list or ALL to remove all fields from the field list for the current table.
SET FIELDS is scoped to the current data session.