Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

PROCEDURE

CREATE PROCEDURE

The CREATE PROCEDURE command establishes a stored procedure, which is a pre-prepared SQL code that can be saved and reused multiple times.

The provided SQL creates a stored procedure named “SelectAllCustomers” that selects all records from the “Customers” table:

Example

CREATE PROCEDURE SelectAllCustomers
AS
SELECT * FROM Customers
GO;

Execute the stored procedure mentioned above in the following manner:

Example

EXEC SelectAllCustomers;