如何确定数字是浮点数还是整数 [英] How to determine whether the number is float or integer
本文介绍了如何确定数字是浮点数还是整数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要在 SQL Server 中编写此查询:
I need to write this query in SQL Server:
IF isFloat(@value) = 1
BEGIN
PRINT 'this is float number'
END
ELSE
BEGIN
PRINT 'this is integer number'
END
请帮我解决这个问题,谢谢.
Please help me out with this, thanks.
推荐答案
declare @value float = 1
IF FLOOR(@value) <> CEILING(@value)
BEGIN
PRINT 'this is float number'
END
ELSE
BEGIN
PRINT 'this is integer number'
END
这篇关于如何确定数字是浮点数还是整数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文