Use a Parameter to Supply a Database or Library Name
Note: This feature is only applicable to queries using an iSeries or SQL Server connection type.
By creating a Standard Parameter and assigning it as the database or library, users may create a single query and connection and process the query for multiple databases or libraries.
- In Query Designer, create a query and select the desired table(s).
- In the Parameters panel, right-click and select Add Parameter. The new parameter is added to the Parameters panel.
- In the Name field, type the value
&Parm01
, and if desired, in the Default Value field, type the default database or library to be used for processing. In the Type field, select the data type for the Parameter. - In the Query Canvas panel, right-click the header section of the desired table. The Table menu appears.
- Select Change Database/Library. The Select Library panel appears.
- Select
&Lib
in the list of databases or libraries, and click Select. Set the Library value to&Parm01
in the Query Options panel. - When executing the query in Query Designer or Excel, modify the
%Parm01
value to the desired database or library to be used for processing the query.
Note:
This new parameter must be first in the parameter list (ID
= 1
).