在SQl Server中将十进制转换为HH.MM格式
问题描述:
如何在SQl Server中将十进制转换为HH.MM格式。示例: - 06.85将转换为07.25,05.60将转换为06.00
How to convert decimal to HH.MM format in SQl Server. Example:- 06.85 will be converted to 07.25, 05.60 will be converted to 06.00
答
您好b $ b
是的你可以做请关注以下链接:
http ://stackoverflow.com/questions/9513851/decimal-to-hhmm-conversion [ ^ ]
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/b8328227-8550-46f4-87c6-95f316052bff [ ^ ]
http://www.sqlservercentral.com/Forums/T opic563502-338-1.aspx [ ^ ]
最好的问候。
Hi
Yes you can do it just follow of links please:
http://stackoverflow.com/questions/9513851/decimal-to-hhmm-conversion[^]
http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/b8328227-8550-46f4-87c6-95f316052bff[^]
http://www.sqlservercentral.com/Forums/Topic563502-338-1.aspx[^]
Best Regards.
试试这个...
Try this...
declare @d decimal(18,2)
set @d=06.85
select @d = case when (100*(@d- floor(@d)))>59 then floor(@d)+1 else floor(@d) end + floor((100*(@d- floor(@d)))% 60)/100
select @d
快乐编码!
:)
Happy Coding!
:)