sql server 查询存储过程返回值
SET QUOTED_IDENTIFIER ON SET ANSI_NULLS ON GO CREATE proc [dbo].[is_yy] @return_value varchar(2) out, @p1 varchar(20), @p2 varchar(50) as begin if @p1='1' begin SET @return_value = '1' RETURN @return_value end if @p2='1' begin SET @return_value = '2' RETURN @return_value end end GO
存储过程如上,执行如下:
DECLARE @return_value1 VARCHAR(50) EXEC @return_value1 =is_yy '', '1','' SELECT @return_value1 DECLARE @return_value2 VARCHAR(50) EXEC @return_value2 =is_yy '', '','1' SELECT @return_value2
执行结果如下: