Automatic Parameters

Most query processors allow you to precompile and store an execution plan–for example, a stored procedure. Precompiling is efficient because it supports reuse of the execution plan and allows users to submit variables as parameters to the plan. A new Open Database Connectivity (ODBC) interface for preparing requests for repeated execution also exploits this efficiency.

Many commercial applications and all ad hoc queries, however, do not use stored procedures. Instead, they use dynamic SQL. SQL Server 7.0 implements a new feature called automatic parameters that caches a plan created for dynamic SQL, turning constants into parameters. The result is less compilation effort, providing many of the efficiencies of stored procedures, even for those applications that do not employ stored procedures.

SQL Server 7.0 also introduces full support for parameterized queries, in which the application identifies the parameters. This is typical with ODBC, OLE DB, and PREPARE/EXECUTE.