Find and replace

Tools & Utilities
Enthusiast

Find and replace

I have column with '1111.'. I need to replace . with ''. How can I do this?
2 REPLIES
Enthusiast

Re: Find and replace

Here is the update statement to replace a field with " (double quotes at the last position) for the values which are having . (dot) in the last position.

UPDATE DBName.TableName

SET FldName = (SUBSTR(FldName,1,INDEX(FldName,'.')-1)) || '"'

WHERE FldName LIKE '%.'

Here FldName is the attribute which you want to update.

Example, if the field contains 1111. then the above update SQL replaces with 1111"

Enthusiast

Re: Find and replace

If your data can have '.' only at the end, then you might want to use a simple TRIM function..

ie

TRIM(TRAILING '.' FROM col1)