Description

The SQL keyword CREATE PROCEDURE is used to create a stored procedure.

A stored procedure is a prepared SQL query, that can be saved and reused anytime. We usually create procedures for the most frequently used SQL queries.

The below SQL creates a stored procedure.

CREATE PROCEDURE all_customers
AS
SELECT * FROM customers
GO;

After the stored procedure is created, it can be executed using the below command.

EXEC all_customers;

Related Links