Archives of the TeradataForum 
 
 
Message Posted: Fri, 20 Jul 2007 @ 13:44:43 GMT 
 
  
 
 
 
 
  
|  Subj:  |   |  Re: Eternally Foolproof Casting from text to number  |   
|     |   
|  From:  |   |  Victor Sokovin  |   
  
 
 
  
|     | I used the IN list rather than an ANSI/ASCII range just because I had it in my head to not presume anything about character
encodings. |     |  
 
  
If you don't mind assuming a certain character ordering (collation) then you might try the following idea: 
     select *
     from (
     select 'A7' COL
     from sys_calendar.calendar
     union
     select '77' COL
     from sys_calendar.calendar
     union
     select '#7' COL
     from sys_calendar.calendar
     union
     select '.7' COL
     from sys_calendar.calendar
     union
     select '%?' COL
     from sys_calendar.calendar
     ) DT
     where DT.COL >= '00'
     and DT.COL <= '99';
 Regards, 
Victor 
 
 
 
 
   
 
 |