Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 07 Oct 2008 @ 15:13:13 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: BTEQ Export - concatenating null values
 
From:   Fred W Pluebell

When you use a column or expression with a string operator (like concatenation) Teradata will do implicit CAST to VARCHAR if needed. So if NumCol is numeric, this works:

     'A'||NumCol

But when you introduce CASE, including shorthand COALESCE or NULLIF forms, different rules apply; so this is invalid:

     'A'||COALESCE(NumCol,'.')

Use explicit CAST to VARCHAR or CHAR:

     'A'||COALESCE(CAST(NumCol AS VARCHAR(15)),'.')

You may also need explicit FORMAT, TRIM, etc. to achieve the desired result.



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023