Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 19 Mar 2008 @ 18:16:23 GMT


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


Subj:   Re: Comparing blanks and Nulls
 
From:   Anomy Anom

<-- Anonymously Posted: Wed, 19 Mar 2008 09:19 -->

If you insert a value into a VARCHAR field with whitespace Teradata will store the whitespace at the end of the string. For example:

TableA:

     RowId BYTEINT
     Name VARCHAR(10)

     INSERT INTO TABLEA VALUES (1,'John');
     INSERT INTO TABLEA VALUES (2,'Johnny  ');

     SELECT RoWID, Name, CHARACTER_LENGTH(Name) FROM TableA;

You should get:

     1, John, 4
     2, Johnny  , 8

You should also be able to store a zero length string ('') in both VARCHAR and CHAR fields. NULLIF(TRIM(ColA), '') should suffice in place of a CASE statement.



     
  <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: 27 Dec 2016