时间:2021-07-01 10:21:17 帮助过:29人阅读
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go CREATE PROCEDURE [dbo].[get_avage_age] -- Add the parameters for the stored procedure here @class_name nchar(10), @CheckDate [datetime] AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; select avg(age) from student where class=@class_name and born<@CheckDate -- Insert statements for procedure here END
USE [gaotest] GO DECLARE @return_value int EXEC @return_value = [dbo].[get_avage_age] @class_name = 'gaosan', @CheckDate = '2009-01-01' SELECT 'Return Value' = @return_value GO 删除存储过程: Drop procedure get_avage_age;
版权声明:本文为博主原创文章,未经博主允许不得转载。
常用SQL语句收藏 <二>
标签:sql 常用操作收藏 sql server