vicky394
vicky394

Reputation: 11

Altering the contents of a column in SQL server 2008

I exported data from an excel file. From that file, I have a column called 'ID'.For now that column has entries like the following.

ID
1.14455,

2.48755,

3.65588,

4.25415,

and so on.

I need to get rid of that comma from the column. How do I do it?

Upvotes: 1

Views: 37

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269853

If there are no other commas in the values, then just use replace():

select replace(col, ',', '')

If there are possibly other commas:

select (case when col like '%,' then left(col, len(col) - 1)
             else col
        end)

Upvotes: 2

Related Questions