首页 > 代码库 > SQL_存储过程返回值

SQL_存储过程返回值

--定义存储过程create procedure GetOutInfo@className nvarchar(50),@Age int,@maxScore int output,@avrageScore int output,@stuCount int outputas beginselect * from Students where ClassName=@className and Age>@Ageselect @maxScore=MAX(chinese) from Students where ClassName=@className and Age>@Ageselect @avrageScore=AVG(chinese) from Students where ClassName=@className and Age>@Ageselect @stuCount=COUNT(*) from Students where ClassName=@className and Age>@Ageendgo--调用存储过程declare @max_score intdeclare @avg_score intdeclare @count_stu intexec GetOutInfo 高三一班,18,@max_score output,@avg_score output,@count_stu outputselect zuigaofen=@max_score,pingjunfen=@avg_score,renshu=@count_stu

 

SQL_存储过程返回值