⟩ How To Create a Simple Stored Procedure in MS SQL Server?
If you want to create a simple stored procedure with no input and output parameters, you can use the "CREATE PROCEDURE" command with a statement batch in a simple format as shown in below:
CREATE PROCEDURE procedure_name AS
statement_1;
statement_2;
...
statement_n;
GO
The following tutorial exercise shows you how to create a simple stored procedure:
USE GlobalGuideLineDatabase;
GO
CREATE PROCEDURE Hello AS
SELECT 'Welcome to:';
SELECT ' GlobalGuideLine.com';
GO
Command(s) completed successfully.
EXEC Hello;
GO
-----------
Welcome to;
(1 row(s) affected)
----------------
GlobalGuideLine.com
(1 row(s) affected)