[英]avoid explicit cast to float?
能
SELECT CAST(2.083 AS float) AS c
以更紧凑的方式编写?
就像是
SELECT 2.083f AS c
?
为避免显式CAST
为float
,请指定浮点常量表达式:
--these both return float with precision 53
EXEC sp_describe_first_result_set N'SELECT CAST(2.083 AS float) AS c;';
EXEC sp_describe_first_result_set N'SELECT 2.083E0 AS c;';
--without scientific notation, the constant is interpreted as numeric(4,3)
EXEC sp_describe_first_result_set N'SELECT 2.083 AS c;';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.