这是我的代码
select len(cast(code as float)),code
from tbl1
where code is not null
这是输出:
我想要在代码列中计数数字。
我不明白为什么最后一个被计为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/