Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 12 Jun 2002 @ 12:33:44 GMT

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

Subj:   Re: Casting to char
From:   Geoffrey Rommel

Generally speaking, it is a bad idea to try to treat "substrings" of integers as if they were character. (By the way, your query is ill- formed: how can a substring of length 1 be equal to a string of length 4?) If you want to select certain digits from an integer, you can isolate them by division, MOD, or some combination thereof. For instance:

integer_col / 100 will return all but the last two digits

integer_col MOD 100 will return only the last two digits

(integer_col / 100) MOD 100 will return the third and fourth digits from the right

I think you'll find that this uses much less CPU time than casting and substringing.


  <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