Search code examples
sqlnetezza

How to remove decimal point and update without decimal for existing records?


I would like to remove the decimal point from the records and update the without decimal point which is already loaded records into the table for 4 fields

datatype: VARCHAR(7)

For example, D21.3 would become D213


Solution

  • All you need is a simple REPLACE function, it takes the column, whatever character or string you want to replace, and what you want to replace it with.

    In this case, you want to replace any decimal points with nothing so the syntax would be:

    UPDATE table_name SET column_name = REPLACE(column_name, '.','')