gpt4 book ai didi

sql - 计算列中的位数

转载 作者:行者123 更新时间:2023-12-02 23:18:44 25 4
gpt4 key购买 nike

这是我的代码

select len(cast(code as float)),code 
from tbl1
where code is not null

这是输出:

enter image description here

我想要代码列中的位数。我不明白为什么最后一个算12而不是8?

最佳答案

将其转换为 int:

select len(cast(code as int)), code 
from tbl1
where code is not null;

据推测,正在计算某种十进制值。

关于sql - 计算列中的位数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25007223/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com