相关疑难解决方法(0)

将小数时间转换为小时和分钟

一直在努力解决这个问题,似乎无法找到正确的答案,尽管有很多提及转换,但没有具体的工作.

我需要将数据类型为float的时间转换为小时和分钟.所以13.50为13.30.数据类型固定为DB中的float,因此无法更改.DB是SQL Server 2008R2

试过:

cast(cast(floor(fdsViewTimesheet.perStandardHours) as    
float(2))+':'+cast(floor(100*(    
fdsViewTimesheet.perStandardHours - floor(fdsViewTimesheet.perStandardHours)))as 
float(2)) as time) AS STANDARD_HOURS
Run Code Online (Sandbox Code Playgroud)

但我收到错误消息"Explicit conversion from data type real to time is not allowed"尝试as char而不是as float查询挂起.

我究竟做错了什么?我只是want to convert a float value into hours and minutes.如果有人能指出我正确的方向,将不胜感激.

t-sql sql-server time sql-server-2008

9
推荐指数
2
解决办法
5万
查看次数

标签 统计

sql-server ×1

sql-server-2008 ×1

t-sql ×1

time ×1