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:
CREATE PROCEDURE SelectAllCustomers AS SELECT * FROM Customers GO; |
Execute the stored procedure mentioned above in the following manner:
EXEC SelectAllCustomers; |