Adam
Adam

Reputation: 2455

Replacing Special Characters in Teradata

I have special character in Teradata database, and I want to remove it.

Example - special character: "aa€bb"  (special charcter is "€" sign)
Desired output: "aabb"

How can I do that?

Upvotes: 2

Views: 13235

Answers (1)

BellevueBob
BellevueBob

Reputation: 9618

If you have Teradata 14 (and sorry, I don't), you should be able to use the new REGEXP_REPLACE function, something like this:

SELECT  'aa€bb' as source_col
       , REGEXP_REPLACE(source_col, '€') as new_col1
       , REGEXP_REPLACE(source_col, '€', NULL, 1, 0, 'c') as new_col2

The first example should do the trick; the second just shows the other function parameter values and their defaults. The third parameter is the replacement string, so when null, it should remove that character.

Upvotes: 3

Related Questions