How to: Create Queries with Unnamed Parameters

You can create a query with an unnamed parameter by specifying a question mark (?) as a placeholder for a literal value. Query and View Designer will give it a temporary name. You can specify as many unnamed parameters in the query as you need.

Note

If you are using multiple parameters, you can use named parameters to help you distinguish them. For details, see How to: Create Queries with Named Parameters.

When you run the query in the Query and View Designer, the Query Parameters Dialog Box is displayed with the temporary name.

Note

The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Visual Studio Settings.

To specify an unnamed parameter

  1. Add the columns or expressions that you want to search to the Criteria pane. If you do not want the search columns or expressions to appear in the query output, remove them as output columns.

  2. Locate the row containing the data column or expression to search, and then in the Filter grid column, enter a question mark (?).

    By default, the Query and View Designer adds the "=" operator. However, you can edit the cell to substitute ">", "<", or any other SQL comparison operator.

See Also

Tasks

How to: Create Queries with Named Parameters

Other Resources

Querying with Parameters