CREATE PROCEDURE Statement

Creates a stored procedure.

Note: The Microsoft Access database engine does not support the use of CREATE PROCEDURE, or any of the DDL statements, with non-Microsoft Access database engine databases.

Syntax

CREATE PROCEDURE procedure (param1 datatype[, param2 datatype][, ...]) AS sqlstatement

The CREATE PROCEDURE statement has these parts:

Part

Description

procedure

A name for the procedure.

param1, param2

From one to 255 field names or parameters.

datatype

One of the primary Microsoft Access SQL Data Types or their synonyms.

sqlstatement

An SQL statement such as SELECT, UPDATE, DELETE, INSERT, CREATE TABLE, DROP TABLE, and so on.


Example

CREATE PROCEDURE Sales_By_CountryRegion ([Beginning Date] DateTime, [Ending Date] DateTime) AS SELECT Customer, [Ship Address] WHERE [Shipped Date] Between [Beginning Date] And [Ending Date]

Remarks

An SQL procedure consists of a PROCEDURE clause that specifies the name of the procedure, an optional list of parameter definitions, and a single SQL statement.

A procedure name cannot be the same as the name of an existing table.

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×