All Forums Database
Max.Lee 8 posts Joined 09/07
18 May 2008
Does teradata support LeftB function

Our data in database contain Chinese characters, you know, one Chinese character contain 2 bytes, and we want to format selected field to 5 bytes length. I think I need some function like "LeftB" in Teradata to get charaters out by bytes.If we can have some function like "LeftB", another question is for how to avoid half split a Chinese character. At the end of string, if we split the Chinese character we will have un-readable character at the end. At this situation, we'd like to cut 1 more byte to cut the whole chinese character out, and link a blank at the end.

rgs 106 posts Joined 02/07
19 May 2008

I think you would be better off defining your column as a Unicode column. That way you avoid such problems as splitting a Chinese character in half since a Unicode character is two bytes. Look at the substring function for extracting a string out of a longer string, if you still want extract a substring.

Max.Lee 8 posts Joined 09/07
20 May 2008

The backgroud is :The data store in our system, and the database is Teradata, we need to use SQL extract data out and generate a text file as a interface file with other system, this "other" system is not under our control, and we must follow strict file format provided by "other" syterm's vendor. Each field in the interface file must has fixed width.

Max.Lee 8 posts Joined 09/07
22 May 2008

Any one can help?

Adeel Chaudhry 773 posts Joined 04/08
22 May 2008

Hello,For that i guess your best option will be to write a UDF for this functionality.Regards,Adeel

-- If you are stuck at something .... consider it an opportunity to think anew.

You must sign in to leave a comment.