Teradata formatting using pipes.

Database

Teradata formatting using pipes.

Hi. I am new to teradata usage. I am formatting few records using pipes so that pipe symbol also comes as output as a seperator for fields. I am using it as
Select
z.productnumber|| '|',
z.producttype || '|',
......
But problem here is pipe symbol is not ending correctly for all records. It is leaving lot of space and coming under next column where actually data should have come. Can someone help me for this.
1 REPLY
Enthusiast

Re: Teradata formatting using pipes.

I've tested the same query in my tables in both Queryman & BTEQ - it's fetching correct result as expected.

If you're getting spaces after column-value (e.g. PRODUCT_NUM |) - then try using TRIM(productname) || '|'

If space is coming after '|' then try to use TRIM outside also -
it happens if your column datatype is CHAR instead of VARCHAR - it'll store spaces ( Suppose CHAR(10) - and your data is 'PRODUCT' which has a length of 7, then 3 spaces it'd append at the end).

Try to use different combinations to get the expected result!!! :-)