首页 > 数据库技术 > 详细

SQL Server进阶(四)存储过程

时间:2018-08-22 21:22:24      阅读:248      评论:0      收藏:0      [点我收藏+]

新建存储过程

Create PROCEDURE [dbo].[p_test]
    @type int
AS
BEGIN
    declare @count int
    if(@type =1)
        begin
            select  @count = (select count(*) from dbo.UserGrowthDetail)
            print @count
            return @count
        end
    else if(@type =2)
        begin
            select  @count = (select count(*) from dbo.UserGrowthValue)
            print @count
            return @count
        end
END

执行存储过程

GO

DECLARE    @return_value int

EXEC    @return_value = [dbo].[p_test]
        @type = 1

SELECT    Return Value = @return_value

GO

 

SQL Server进阶(四)存储过程

原文:https://www.cnblogs.com/cnki/p/9520338.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!