日期:2014-05-17 浏览次数:20453 次
create proc proc_three(@x float,@y float,@z float)
as
set nocount on
declare @max float,@min float
select @max=max(col),@min=min(col)
from
(select @x as col
union all select @y
union all select @z
)t
select @max as 'max',@min as 'min'
go
exec proc_three 2,3,7
/*
max min
-----------------
7.0 2.0
*/
create proc proc_three(@x float,@y float,@z float)
as
set nocount on
select col
from
(select @x as col
union all select @y
union all select @z
)t
order by col
declare @max float,@min float
select @max=max(col),@min=min(col)
from
(select @x as col
union all select @y
union all select @z
)t
print '最大值:' +str(@max)
print '最小值:' +str(@min)
go
exec proc_three 2,3,7
/*
col
-----------------
2.0
3.0
7.0
*/
create proc proc_three(@x float,@y float,@z float)
as
declare @t table ( num float )
insert into @t values(@x),(@y),(@z)
select * from @t order by 1
select MAX(num) max from @t
select MIN(num) min from @t