Adding a Parameter to a WHERE Clause
When you want parameters to be used in a WHERE clause, you must add them from cells in the Criteria column.
To include a parameter in the WHERE clause of a parameterized query
|
1.
|
In the resource tree, right-click a container and select New Parameterized Query. |
|
2.
|
In the Input window, supply a unique name for the parameterized query and click OK. |
The editor for building the resource opens in the right pane.
|
4.
|
Drag and drop tables, views, or other procedures from the Studio resource tree into the Model panel. |
|
5.
|
In the Grid panel, click a Column cell to select one of the column names. |
|
6.
|
Click a second Column cell and select another column name. |
|
7.
|
Right-click the Criteria cell corresponding to the second column name under Column, and select Parameter. |
|
8.
|
In the Add Parameter window, supply a name for the parameter, select the data type, and click OK. |
This parameter appears in the Criteria column.
|
9.
|
Click the SQL Script tab if you want to view the auto-generated SQL script. |
The parameter you added is placed in the parameterized query’s WHERE clause.
|
10.
|
Save the parameterized query. |