PROCEDURE Clause Examples

 

SQL statement

Description

 

PROCEDURE Category_List;
SELECT DISTINCTROW
[Category Name], [Category ID]
FROM Categories
ORDER BY [Category Name]

Names the query Category_List, and the PROCEDURE clause is removed.

PROCEDURE Summary
[Beginning Date] DateTime,
[Ending Date] DateTime;
SELECT DISTINCTROW
[Shipped Date], [Order ID], [Order Amount],
Format([Shipped Date], "yyyy")
AS Year
FROM Orders
WHERE [Shipped Date]
Between [Beginning Date] And [Ending Date]

Names the query Summary and includes two parameters.  The PROCEDURE clause is changed to the following PARAMETERS declaration:

PARAMETERS [Beginning Date] DateTime,
[Ending Date] DateTime;