Parameterized Queries - Teradata SQL Assistant

Teradata® SQL Assistant for Windows User Guide

Teradata SQL Assistant
Release Number
October 2018
English (United States)
Last Update
Product Category
Teradata Tools and Utilities

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, the same value is used in all places.

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 to include quotes in the query itself, as in the above example. For more information, see Setting Query Options.