与えられた数字のケタ数
Posted feedbacks - SQL
@numが0の時は| 1 | 1 | @numが-2469の時は| 4 | 1000 | @numが10.25なら| 2 | 10 | になります。
1 2 3 4 5 6 7 8 9 10 11 | set @num = 2469;
select
l as '桁'
, rpad('1', l, '0') as '最大位'
from (
select
length(
floor(case when @num < 0 then @num * -1 else @num end)
) as l
) as d
;
|



susu
#3396()
Rating0/0=0.00
このお題はsusuさんの投稿です。ご投稿ありがとうございます。
[ reply ]