Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 12 Jun 2002 @ 10:46:51 GMT

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

Subj:   Re: Casting to char
From:   Claybourne L. Barrineau


Try this:

Select *
From table
Where substr((trim(stringvarx)),1,4) = '5060'

The 'trim' function will convert integers to characters and remove any leading spaces.

I'm assuming you want the first 4 digits of the integer. In your example below (if you had casted the expression as a character), you would have received only 1 character starting at the 4th position from the left.

Hope this helps,

Claybourne Barrineau

  <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: 28 Jun 2020