-1

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

Krishna
  • 25
  • 4
  • 2
    Use the `REPLACE` function on an update command.... something like `UPDATE table_name SET column_name = REPLACE(column_name, '.','')` – Mark Dec 21 '22 at 13:41
  • 1
    Adding to Mark's comment, you will need SQLToolkit installed to use REPLACE function. Here is the [documentation](https://www.ibm.com/docs/en/netezza?topic=tuf-replace-1) for REPLACE – Rajshekar Iyer Dec 21 '22 at 14:01
  • *Someone help me, please* is not an acceptable question here. You may want to review [ask], and then [edit] your post. – Ken White Dec 21 '22 at 21:26
  • A field with datatype `CHAR (7)` does not have a decimal point. – Luuk Dec 29 '22 at 12:33
  • @Luuk it looks like from his example data, there is alphanumeric characters in the field. I think we can assume this data was loaded from an external source and they are looking to clean the data up in SQL. – Marc Pfister Dec 29 '22 at 13:52
  • A good question should leave no room for *assumptions*. – Luuk Dec 29 '22 at 15:02

1 Answers1

1

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, '.','')
Marc Pfister
  • 134
  • 11