创建一个存储过程,计算任意两个整数中的最大值,并将其返回。两个整数由用户调用时通过参数传递。

解决方案 »

  1.   

    create proc [max]
     @a int,
     @b int
    asselect case when @a>@b then @a else @b end
    goexec [max] 1,11drop proc [max]
      

  2.   

    没看明白,要的是这个??if exists(select 1 from sysobjects where id=object_id('sp_bigger') and xtype='P') drop procedure sp_bigger
    go
    create procedure sp_bigger(@a int, @b int)
    as
    if @a>@b
    select @a as bigger
    else
    select @b as bigger
    go
      

  3.   


    create procedure sp_jjjj (@a int ,@b int,@c int output)
    as
    if (@a>@b)
    select @c=@a 
    else
    select @c=@b
      

  4.   

    SELECT CASE WHEN @a>@b then @a else @b end 
    go
      

  5.   

    to RicCC() ( )  -------------------SQL2000没这样的写法^^;