Queries can contain Named Parameters, making it easy to reuse a query because the only changes are the data values (for example, in a Where clause).
Named Parameters function like variables. Enter the value for a named parameter once. If it is used in multiple places within the query that same value is used in all places.
Note: The values entered for named parameters are saved to the Notes column of History for future reference.
Named Parameters are indicated by a “?” immediately followed by a name. The name can consist of alphanumeric characters plus the “_” symbol.
When an parameterized query is executed, a prompt appears for each parameter before the query is submitted.
For example, if the following query is submitted,
Select * From PhoneBook Where LastName Like '?NameStart'
a prompt appears to enter a value for NameStart.
Parameter values are directly inserted into the query, which means they might need to be enclosed in quotes. Although quotes can be used when prompted for the data value, it is generally recommended that quotes be included in the query itself, as in the above example. See “Setting Query Options” on page 67 for more information.
1 Select Tools > Options.
2 Select the Query tab.
3 Clear the option Allow use of Named Parameters in queries.
Note: If an empty string is entered, or the
Cancel button is used, the query is left unchanged. This allows for those rare cases where
SQL Assistant incorrectly identifies a regular part of the query as being a parameter