22,209
社区成员
发帖
与我相关
我的任务
分享
--自己写函数
create function kk (
@num int --参数
)
returns int
as
begin
declare @n int
set @n=1
while POWER(2,@n)<>@num
set @n=@n+1
return @n
end
select dbo.kk (64)
-----------
6
--自己写函数
create function kk (
@num int --参数
)
returns int
as
begin
declare @n int
set @n=1
while POWER(2,@n)<>@num
set @n=@n+1
return @n
end
select dbo.kk (64)
-----------
6
declare @num int,@n int
set @num=64
set @n=1
while POWER(2,@n)<>@num
set @n=@n+1
select @n
-----------
6
EXP()函数