CREATE PROCEDURE

After you have planned, written, and debugged the code that will be executed inside the stored procedure, you can create the procedure. The CREATE PROCEDURE statement is required to create a stored procedure, as outlined in the following syntax:

CREATE PROCEDURE <emphasis>procedure_name</emphasis>>
{<@parameter> <data type>}  [VARYING] [= 
						default] [OUTPUT]][,...
						n]
[WITH { RECOMPILE | ENCRYPTION | RECOMPILE, ENCRYPTION} ]
AS
<sql_statements>

Table 5.4 lists the options for the CREATE PROCEDURE statement.

Table 5.4. Stored Procedure Options
Option Description
< procedure_name > This is the name of the stored procedure you are creating.
< @parameter > If you want to pass parameters into a stored procedure, you must ...

Get Writing Stored Procedures for Microsoft SQL Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.