Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 06 Jun 2011 @ 13:40:56 GMT


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


Subj:   Re: Length Function
 
From:   Geoffrey Rommel

Allow me to summarize the various answers to this question.

First of all, "length" is an ODBC function, not a Teradata function. The ODBC driver in SQL Assistant accepts it, but eventually it gets translated to the Teradata equivalent, which is "characters". Or maybe it doesn't:

     sel characters(100);
      *** Failure 3580 Illegal use of CHARACTERS, MCHARACTERS, or OCTET_LENGTH functions.

Next, length applies only to character strings. Thus length ('100') makes sense and returns 3. Length(100) cannot be evaluated without making some assumption about how the number 100 would look if it were a character string. 100 fits into a byteint, so ODBC or the engine assumes a default byteint format ('+999'), formats the number according to it (' 100'), and returns the length of that formatted string (4).


Hope this helps.



     
  <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