Forum Discussion
Question about decimal numbers in SQL Server Management Studio
- Jan 16, 2025
en-US has the period as the decimal separator, so this is just wrong.
You're on the right track though.
Locally, using SSMS 20 and SQL Server 2022, on a OS with Norwegian regional formatting and "Latin1_General_CI_AS" as SQL Server collation, I am denied converting numbers on the format "0.4" as floats:TITLE: Microsoft SQL Server Management Studio
------------------------------Error inserting data into table. (Microsoft.SqlServer.Import.Wizard)
------------------------------
ADDITIONAL INFORMATION:Error inserting data into table. (Microsoft.SqlServer.Prose.Import)
------------------------------
The given value '0.4' of type String from the data source cannot be converted to type float for Column 9 [Basic]. (Microsoft.Data.SqlClient)
------------------------------
Failed to convert parameter value from a String to a Double. (Microsoft.Data.SqlClient)
------------------------------
Input string was not in a correct format. (mscorlib)
------------------------------
BUTTONS:OK
------------------------------Might be earlier versions assumed it was the regional thousands separator.
In Norwegian regional formatting, the comma is the decimal separator, and I was required to update my source file to follow my regional formatting scheme.
Alternatively, you could temporarily change the regional format of the machine you're running SSMS on, restart SSMS, then try again.That worked for me (note: I have a local install of SQL Server. It was not restarted after the regional format change.)
marlon12_note that the preview is before you change your column data types. The preview just tells you how your data is columnated, not how it will be stored as data.
and atem are not decimal numbers
They are decimals, but by default strings are converted to decimal using en-US format and this means the dot is not treaten a decimal separator but as thousend separator and so you get thousend's values. You have to modify the string-2-decimal/regional format.
- SivertSolemJan 16, 2025Iron Contributor
en-US has the period as the decimal separator, so this is just wrong.
You're on the right track though.
Locally, using SSMS 20 and SQL Server 2022, on a OS with Norwegian regional formatting and "Latin1_General_CI_AS" as SQL Server collation, I am denied converting numbers on the format "0.4" as floats:TITLE: Microsoft SQL Server Management Studio
------------------------------Error inserting data into table. (Microsoft.SqlServer.Import.Wizard)
------------------------------
ADDITIONAL INFORMATION:Error inserting data into table. (Microsoft.SqlServer.Prose.Import)
------------------------------
The given value '0.4' of type String from the data source cannot be converted to type float for Column 9 [Basic]. (Microsoft.Data.SqlClient)
------------------------------
Failed to convert parameter value from a String to a Double. (Microsoft.Data.SqlClient)
------------------------------
Input string was not in a correct format. (mscorlib)
------------------------------
BUTTONS:OK
------------------------------Might be earlier versions assumed it was the regional thousands separator.
In Norwegian regional formatting, the comma is the decimal separator, and I was required to update my source file to follow my regional formatting scheme.
Alternatively, you could temporarily change the regional format of the machine you're running SSMS on, restart SSMS, then try again.That worked for me (note: I have a local install of SQL Server. It was not restarted after the regional format change.)
marlon12_note that the preview is before you change your column data types. The preview just tells you how your data is columnated, not how it will be stored as data.- marlon12_Jan 20, 2025Copper Contributor
Hi, sorry for late reponse, thank you for you comment, I changed to regional format and it worked like I except, thank you so much