sql 存储过程 output参数的使用

/*嵌套存储过程中需要输出来的参数*/
output 就是这个存储过程返回的值 也可以说输出的值
--创建存储过程 求最大值
CREATE PROCEDURE [dbo].[P_Max]
@a int, -- 输入
@b int, -- 输入
@Returnc int output --输出
AS

if (@a>@b)
set @Returnc =@a
else
set @Returnc =@b

-- 调用
declare @Returnc int
exec P_Max 2,3,@Returnc output
select @Returnc
posted @ 2016-11-10 12:27  天启♘  阅读(5913)  评论(0编辑  收藏  举报