Forum Discussion

marlon12_'s avatar
marlon12_
Copper Contributor
Jan 15, 2025
Solved

Question about decimal numbers in SQL Server Management Studio

Hello, everyone, I am new using SSMS, I created a data base. I used the "import flat file option" to import a csv file, in preview data I uncheck the use rich data type detection, in the modify colu...
  • SivertSolem's avatar
    SivertSolem
    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.

Resources