I have a data table where I have numbers expressed in the following format:
Incorrect | What I want to format it to
------------------------------------------
123,452,03 | 123,452.03
234.00 | 234.00
456,02 | 456.02
The challenge that I have is some numbers have more than one comma. I know this can be solved via regex, but can use some help in constructing the string. The logic should be as following:
- Check if string has comma
- If after the comma there are two numbers and they are at the end of the string
- Replace the comma value with a period
- If after the comma there are three numeric values, or if is in the middle of the string, do nothing.
EDIT: Using Sql Server to construct the expression.