JetSQL » Declarations » PARAMETERS

PARAMETERS name datatype [, name datatype [, ...]]

The PARAMETERS declaration creates parameters for a parameter query that you use regularly.

When you run the query interactively, you will be presented with a dialog box in which you must enter the value(s) of the parameters. Each parameter consists of a name, which will appear in the dialog box if the query is run interactively, and a valid data type. If the name includes spaces or punctuation it must be enclosed in square brackets.


PARAMETERS Bargain Currency;
SELECT Item, unitPrice AS Price FROM Products
WHERE UnitPrice < Bargain;

In this example, suppose that you regularly ran a query to return a list of products that you wanted to promote as bargains, but wanted the freedom to alter the 'definition' of a bargain, you could use the following query which allows you to specify the value of a Bargain at run time.

Note that the PARAMETERS declaration must appear first. You can include more than one parameter, but they must be separated by commas (,). And finally, the PARAMETERS declaration must end with a semi-colon.

Language(s): MS SQL Server
PARAMETERS [Select a musician] Text, [Select a tune type] Text;
WHERE Type = [Select a tune type] AND Musician = [Select a musician];

This example returns a list of tune names in response to criteria concerning the tune type and musician imposed by the user.

Language(s): MS SQL Server

See Also: