CI CellName 经度 字符串长度
23331 昌江海尾五大1 108.86625 7
23123 昌江石碌水泥3 109.07 6
50071 儋州第二中学1 109.5784 7SELECT A.CI,A.CellName, B.[经度],len(B.[经度])
为什么108.86625,109.5784的长度均为7????,不是9与8呢哦?
且LTRIM(B.[经度]),小数点后面才3位了,为什么???
23331 昌江海尾五大1 108.86625 7
23123 昌江石碌水泥3 109.07 6
50071 儋州第二中学1 109.5784 7SELECT A.CI,A.CellName, B.[经度],len(B.[经度])
为什么108.86625,109.5784的长度均为7????,不是9与8呢哦?
且LTRIM(B.[经度]),小数点后面才3位了,为什么???
---float类型精度7位,换成decimal
---try
declare @tb table (CI int,CellName nvarchar(10),经度 float)
insert into @tb values (23331,'昌江海尾五大1',108.86625)
insert into @tb Values (23123,'昌江石碌水泥3',109.07)
insert into @tb values (50071,'儋州第二中学1',109.578)
select *, len(replace(cast(经度 as decimal(15,8)),'0',' ')) from @tbCI CellName 经度
----------- ---------- ---------------------- -----------
23331 昌江海尾五大1 108.86625 9
23123 昌江石碌水泥3 109.07 6
50071 儋州第二中学1 109.578 7