<div style="text-indent: 2em; font-size: larger;">

创建存储过程的方法和创建数据库中任何其他对象一样,除了它使用的AS关键字外。存储过程的基本语法如下:

CREATE PROCEDURE|PROC 
	[ [schema.] [VARYING] [= ] [OUT[PUT]]
[READONLY]
	[,  [schema.] [VARYING] [=  [OUT[PUT]]
[READONLY]
	[, ...
	   ...
		]]
	[WITH
	 RECOMPILE| ENCRYPTION | [EXECUTE AS { CALLER|SELF|OWNER|<'user name'>}]
	[FOR REPLICATION]
	AS
	  | EXTERNAL NAME ..	

基本存储过程的示例:

	USE AdventureWorks2008
GO
CREATE PROC spEmployee
AS
    SELECT * FROM HumanResources.Employee;