SQL_存储过程返回值
--定义存储过程 create procedure GetOutInfo @className nvarchar(50), @Age int, @maxScore int output, @avrageScore int output, @stuCount int output as begin select * from Students where ClassName=@className and Age>@Age select @maxScore=MAX(chinese) from Students where ClassName=@className and Age>@Age select @avrageScore=AVG(chinese) from Students where ClassName=@className and Age>@Age select @stuCount=COUNT(*) from Students where ClassName=@className and Age>@Age end go --调用存储过程 declare @max_score int declare @avg_score int declare @count_stu int exec GetOutInfo ‘高三一班‘,18,@max_score output,@avg_score output,@count_stu output select ‘zuigaofen‘=@max_score,‘pingjunfen‘=@avg_score,‘renshu‘=@count_stu
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。