---=====存储过程可以设返回值,但要设批处理才能获得返回值的对应标量值====------
USE Student_Back
GO
CREATE PROCEDURE Stu_Age
(@num nvarchar(100))
--@returnVaule int out
AS
BEGIN
DECLARE @i int
SELECT S_NUMBER,datediff(year,BIRTHDAY,getdate()) as 年龄
FROM [Student_Back].[dbo].[T_Student] where S_NUMBER=@num
set @i=@@error
return 3
END
GO
declare @re int;
exec @re=[dbo].[Stu_Age] 'B0451101';
select @re as ret;
GO