Using Parameters

What is a Parameter?

A parameter is a placeholder for a variable that contains a value of some type that is passed to a database server along with the SQL text at the query execution time. Also, a parameter can hold values returned by a server after query or stored procedure execution.

You can benefit from using parameters in the following situations:

  • When you execute a query multiple times with different input values
  • When you debug a query from your application code

Adding Parameters to a Query Text

Parameters are declared using @ prefix followed by a parameter name. A prefix is included to the parameter name.

For example:

SELECT
  Employee.*
FROM
  HumanResources.Employee
WHERE
  Employee.Title = @Job AND
  Employee.VacationHours <= @Level

@Job and @Level are parameters in this query.

Modifying Parameter Values and Types

When you run a query that contains parameters with empty values, you will be automatically prompted to initialize them.

To set parameter values and types, select the Edit Parameters command on the Devart - SQL toolbar or main menu. In the Edit Parameters dialog box, set parameter type, value, and other properties.

For more information, refer to the Edit Parameters Dialog Box topic.