在SQl Server中将十进制转换为HH.MM格式 [英] convert decimal to HH.MM format in SQl Server

查看:95
本文介绍了在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 [<一个href =http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/b8328227-8550-46f4-87c6-95f316052bfftarget =_ blanktitle =New Window> ^ ]

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!
:)


这篇关于在SQl Server中将十进制转换为HH.MM格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆