Using Variables in a Synonym
The Synonym Editor allows you to define variables in a synonym to specify synonym attributes, such as the connection name or the table name. For an example of how variables in a synonym can be used, see Iterating Through Multiple Tables.
Add a Variable to a Synonym
- Procedure
- Right-click an object in the Synonym Editor, point to Insert, and then click Variable.
- A new folder
named Variables is added to the object tree, with &&VARIABLE1
as an entry. The Properties pane shows the attributes of the variable,
as shown in the following image.
- If desired, change the name of the variable and enter a default value in the appropriate fields.
Add a Variable for an Attribute
Attributes in a synonym that can be specified with a variable are identified with an attribute name in blue, as shown in the following image.
To add variables for an attribute:
- Procedure
- Right-click the attribute in the Properties pane and click Parameterize Value.
- Expand the Variables folder. A variable with a name that combines the synonym name with the variable name has been added.
- Click the
variable name to assign values, as shown in the following image.