The CREATE PROCEDURE command establishes a stored procedure, which is a precompiled set of SQL instructions that can be saved and reused.
The provided SQL creates a stored procedure named “SelectAllCustomers,” which retrieves all records from the “Customers” table.
CREATE PROCEDURE SelectAllCustomers AS SELECT * FROM Customers GO; |
Execute the aforementioned stored procedure in the following manner:
EXEC SelectAllCustomers; |