`

SQL Server 一个简单的存储过程

阅读更多
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

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics