Skip to main content

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.

  1. In Query Designer, create a query and select the desired table(s).
  2. In the Parameters panel, right-click and select Add Parameter. The new parameter is added to the Parameters panel.
  3. 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.
  4. Note: This new parameter must be first in the parameter list (ID = 1).

  5. In the Query Canvas panel, right-click the header section of the desired table. The Table menu appears.
  6. Select Change Database/Library. The Select Library panel appears.
  7. Select &Lib in the list of databases or libraries, and click Select. Set the Library value to &Parm01 in the Query Options panel.
  8. 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.

Was this article helpful?

We're sorry to hear that.

Powered by Zendesk