尝试以下满足您需求的变体之一(值表示 BigInt 的 Max Value 和其他 Max 类型值)。
http://sqlfiddle.com/#!6/745c8f/1
CREATE TABLE Table1
(
FloatDefault float, --Default is 24 bits giving 7 digit precision and 4 bytes storage
Float24 float(24), --Max for 4 bytes storage, 24 bits giving 7 digit precision and 4 bytes storage
Float53 float(53) --Max for 8 bytes storage, 53 bits giving 15 digit precision and 8 bytes storage
);
INSERT INTO Table1 VALUES(-9223372036854775808, -9223372036854775808, -9223372036854775808); --Max Negative Value of a Big Int
INSERT INTO Table1 VALUES(9223372036854775807, 9223372036854775807, 9223372036854775807); --Max Positive Value of a Big Int
INSERT INTO Table1 VALUES(-2147483648, -2147483648, -2147483648); --Max Negative Value of a Big Int
INSERT INTO Table1 VALUES(2147483647, 2147483647, 2147483647); --Max Positive Value of a Big Int
INSERT INTO Table1 VALUES(123456789012345678901234567890, 123456789012345678901234567890, 123456789012345678901234567890);
INSERT INTO Table1 VALUES(123456789012345678901234567890.12345678, 123456789012345678901234567890.12345678, 123456789012345678901234567890.12345678);
INSERT INTO Table1 VALUES(1234567890, 1234567890, 1234567890);
INSERT INTO Table1 VALUES(1234567890.0123456789, 1234567890.0123456789, 1234567890.0123456789);
INSERT INTO Table1 VALUES(22.0/7.0, 22.0/7.0, 22.0/7.0); -- Value of Pi
INSERT INTO Table1 VALUES(1, 1, 1);
INSERT INTO Table1 VALUES(2.0, 2.0, 2.0);
INSERT INTO Table1 VALUES(2000.0, 2000.0, 2000.0);
SELECT
FloatDefault,
Float24,
Float53,
CAST(CAST(Float53 AS NUMERIC(38)) AS VARCHAR(100)), -- 38 is the max precision
CAST(CAST(Float53 AS NUMERIC(38,5)) AS VARCHAR(100)),
STR(Float53),
STR(Float53, 38),
STR(Float53, 38,5),
LTRIM(RTRIM(STR(Float53, 38,5))),
CONVERT(VARCHAR, Float53),
CONVERT(VARCHAR(100), Float53),
CONVERT(NUMERIC(38,5), Float53)
FROM Table1
GO