select
(case ltrim(rtrim(boot_time))
when boot_time = NULL then boot_time = 0
else cast(boot_time as float) end) as boot_time
from plandetails
麻煩看下哪里問題因為boot_time在表里是char類型
我在to excel的時候要把它轉換為float類型
但是其中也有Null值
(case ltrim(rtrim(boot_time))
when boot_time = NULL then boot_time = 0
else cast(boot_time as float) end) as boot_time
from plandetails
麻煩看下哪里問題因為boot_time在表里是char類型
我在to excel的時候要把它轉換為float類型
但是其中也有Null值
Server: Msg 8114, Level 16, State 5, Line 1
将数据类型 varchar 转换为 numeric 时出错。
select case when boot_time is not null then cast(boot_time as float) else 0 end from plandetails
当boot_time含有: - /就不能转成float
select cast(boot_time as decimal(18,2))
或者把: - /去掉再转为float
cast(replace(boot_time,"-","") as float
boot_time 含有-/等符号,你怎么把它转成为float啊
我如果不想加where該怎么解決?
将数据类型 varchar 转换为 float 时出错。