避免显式强制转换为浮动?
avoid explicit cast to float?
可以
SELECT CAST(2.083 AS float) AS c
写得更紧凑?
类似于
SELECT 2.083f AS c
?
要避免显式 CAST
到 float
,请指定 floating point constant expression:
--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;';
可以
SELECT CAST(2.083 AS float) AS c
写得更紧凑?
类似于
SELECT 2.083f AS c
?
要避免显式 CAST
到 float
,请指定 floating point constant expression:
--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;';