How to remove new line characters from the end of a field in Teradata

Database
Enthusiast

How to remove new line characters from the end of a field in Teradata

Hi,
We have a table where we have 'New Line Characters(Carriage Return)' at the end of many fields which is unreadable by the downstream system.We need to remove all the 'New Line Characters' from the end of all the fields.Can we use trim function/UDF to achieve this?Any other effective way to achieve this?

Regards,
Indranil Roy
3 REPLIES
Teradata Employee

Re: How to remove new line characters from the end of a field in Teradata

oreplace(column, chr(12),'')

 

or chr(11) depending on if you have CR or LF

 

Thanks

 

Dave

Enthusiast

Re: How to remove new line characters from the end of a field in Teradata

@David
Just curious if the character is present at the end can we use trim function for the same?

Regards,
Indranil
Highlighted
Junior Contributor

Re: How to remove new line characters from the end of a field in Teradata

RTrim(col, '0A0D'xc)

removes all trailing Carriage Returns or Line Feeds.