Welcome to plsql4all.blogspot.com SQL, MYSQL, ORACLE, TERADATA, MONGODB, MARIADB, GREENPLUM, DB2, POSTGRESQL.

Sunday, 26 October 2014

Trim in Teradata

We can trim a character in teradata as shown below:-

If you want to trim particuler character from both the end (Leading and Trailing) then you need to use 'BOTH' keyword:-

SELECT TRIM (BOTH '1' FROM '12341');

Output is:- 234

You can trim leading character from a string:-

SELECT TRIM (LEADING '1' FROM '11234');

Output is:- 234

You can trim trailing character from a string:-

SELECT TRIM (TRAILING '4' FROM '12344');

Output is:- 123

No comments:

Post a Comment

Please provide your feedback in the comments section above. Please don't forget to follow.