D.Loo D.Loo - 1 year ago 196
SQL Question

Trim inner blanks in teradata

How do you trim whitespaces in teradata? Do I need to write a procedure for it?

Answer Source

OREPLACE can be installed in releases prior to TD 14.x as a UDF from Teradata Dev Exchange, it appeared as a native function around TD 14.0 or TD 14.10:

SELECT OREPLACE(colA, ' ', ''); -- Replace all whitespace, leading and trailing included

or you can use REGEX_REPLACE, if supported by your release of Teradata:

SELECT REGEX_REPLACE(colA, '[@\s+]', '', 1, 0, 'i');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download