create procedure Sstu @dept varchar(20),
@avg_age smallint output,@max_age smallint output
AS
select * from Student where sdept=@dept
select @avg_age=avg(sage) from Student where sdept=@dept
select @max_age=max(sage) from Student where sdept=@dept
declare @avg_age smallint,@max_age smallint
exec Sstu 'cs',@avg_age output,@max_age output
select @avg_age as avg,@max_age as max
@avg_age smallint output,@max_age smallint output
AS
select * from Student where sdept=@dept
select @avg_age=avg(sage) from Student where sdept=@dept
select @max_age=max(sage) from Student where sdept=@dept
declare @avg_age smallint,@max_age smallint
exec Sstu 'cs',@avg_age output,@max_age output
select @avg_age as avg,@max_age as max