请你帮我转换浮动时间吗? 我有价值(小时数),看起来像:
[- 104.59 / -104:35:00], [0.25 / 00:15:00], [5,84 /05:50:00]
我无法找到解决方案,因为在类似问题上并没有" +"和" - "值。
答案 0 :(得分:0)
with cte as (select * from (values ('-104.59'), ('0.25'), ('5,84')) t(val))
select val, concat(iif(charindex(':',result)>3,'','0'), result) result
from
cte
cross apply (select replace(val, ',', '.') rp) t
cross apply (select charindex('.', rp) ind) t1
cross apply (select concat(substring(rp, 1, ind-1), ':', cast(substring(rp, ind+1, len(rp)) as int)*60/100, ':00') result) t2