O'Reilly logo

Writing Stored Procedures for Microsoft SQL Server by Matthew Shepker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required