Last active
July 3, 2017 08:36
-
-
Save pascalberger/3607bbb7c9dd94431f85a31b892fd3e0 to your computer and use it in GitHub Desktop.
SQL Server Double.MaxValue default value issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- It is not possible to use .NET Double.MaxValue=1.7976931348623157E+308 as default value for a float field. | |
-- Error: The floating point value '1.797693134862316e+308' is out of the range of computer representation (8 bytes). | |
-- CREATE TABLE FloatDefaultReproduction (FieldInt integer, FieldFloat float DEFAULT (1.7976931348623157E+308)); | |
-- Same error if max value representation as returned by SQL Server is used. | |
-- Error: The floating point value '1.79769313486232E+308' is out of the range of computer representation (8 bytes). | |
-- CREATE TABLE FloatDefaultReproduction (FieldInt integer, FieldFloat float DEFAULT (1.79769313486232E+308)); | |
-- Workaround 1: | |
-- CREATE TABLE FloatDefaultReproduction (FieldInt integer, FieldFloat float DEFAULT ((CONVERT(float,'1.7976931348623157E+308')))); | |
-- Workaround 2: | |
--CREATE TABLE FloatDefaultReproduction (FieldInt integer, FieldFloat float DEFAULT ((1.0E+308+7.976931348623157E+307))); | |
-- Statement throwing error | |
INSERT FloatDefaultReproduction | |
(FieldInt) | |
VALUES | |
(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment