I'm trying to do a SQL replace when there's a count of two or more of a specific char, but the kicker is that I need to replace all except the last one.
So, let's say I have this string 1.235.36
and I'm trying to remove the first decimal and leave the last one.
I want to turn 1.235.36 to 1235.36.
I have the count method here but I'm having trouble thinking a way to replace it without replace all of the decimal.
declare @myvar varchar(20)
set @myvar = '1.234.54'
select len(@myvar) - len(replace(@myvar,'.',''))
Update: I do not want to replace all, but keep last one. I'm using SQL Server