Introduction
In SQL Server, a procedure is a stored program that you can pass parameters into. It does not return a value like a function does. However, it can return a success/failure status to the procedure that called it.
Syntax
- CREATE { PROCEDURE | PROC } [schema_name.]procedure_name
- [ @parameter [type_schema_name.] datatype
- [ VARYING ] [ = default ] [ OUT | OUTPUT | READONLY ]
- , @parameter [type_schema_name.] datatype
- [ VARYING ] [ = default ] [ OUT | OUTPUT | READONLY ] ]
- [ WITH { ENCRYPTION | RECOMPILE | EXECUTE AS Clause } ]
- [ FOR REPLICATION ]
- AS
- BEGIN
- [declaration_section]
- executable_section
- END;