Change dot separated value to a comma separated value

  • Hello, 
    I need to insert value to a sql server table which is then the source for excel worksheet.
    Simple, but I have two problems.
    First, values in worksheet are dot separated (123.123) and i want them to be comma separated and the other thing is that some values in worksheet are interpreted as DATE values.
    Could you please help me to solve the problem?
    Closest i came up is this code below but it moves separator to the end of value and it becomes 123456781234.0000
    DECLARE @zmienna decimal(19,4)
    SET @zmienna = 12345678.1234

    INSERT INTO TestTable
    SELECT REPLACE(REPLACE(CAST(@zmienna as numeric(19,4)),'.',''),'.',',')

  • lukaszpiech - Thursday, December 13, 2018 5:30 AM

    Hello, 
    I need to insert value to a sql server table which is then the source for excel worksheet.
    Simple, but I have two problems.
    First, values in worksheet are dot separated (123.123) and i want them to be comma separated and the other thing is that some values in worksheet are interpreted as DATE values.
    Could you please help me to solve the problem?
    Closest i came up is this code below but it moves separator to the end of value and it becomes 123456781234.0000
    DECLARE @zmienna decimal(19,4)
    SET @zmienna = 12345678.1234

    INSERT INTO TestTable
    SELECT REPLACE(REPLACE(CAST(@zmienna as numeric(19,4)),'.',''),'.',',')

    Surely this is a display/presentation issue?
    Storing commas in numeric data turns that data into useless text.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Storing commas in numeric data turns that data into useless text.

    This info changes my decision. I will leave data as it is and i'll try to solve problem in different way.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply