Partilhar via


How to: Create Queries with Unnamed Parameters (Visual Database Tools)

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.

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

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

Other Resources

Querying with Parameters (Visual Database Tools)

Help and Information

Getting SQL Server 2005 Assistance