--定义存储过程 create procedure GetOutInfo @className nvarchar(50), @Age int, @maxScore int output, @avrageScore int output, @stuCount int output as begin select * from Students where [email protected] and Age>@Age select @maxScore=MAX(chinese) from Students where [email protected] and Age>@Age select @avrageScore=AVG(chinese) from Students where [email protected] and Age>@Age select @stuCount=COUNT(*) from Students where [email protected] 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‘[email protected]_score,‘pingjunfen‘[email protected]_score,‘renshu‘[email protected]_stu
时间: 2025-01-08 20:18:23