存储过程
建立存储过程:
CREATE PROCEDURE pro_name
@a1 AS int (定义传入参数)
@a2 AS char(30) (定义传入参数)
AS
BEGIN SET
DECLARE @b1 nvarchar(200) (定义变量)
DECLARE @b2 char(20) (定义变量)
SET @b1=’0’ (给变量赋值)
(sql语句)
RETURN @b1 (返回参数)
END
执行存储过程:EXEC pro_name @a1, @a2