Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 17 Jan 2012 @ 23:10:00 GMT

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

Subj:   Re: How to CAST a number without getting a decimal point.
From:   Dieter Noeth

BOB DUELL wrote:

  How can I avoid the trailing decimal point in the result of casting a numeric result to character? In other words, this query:  

          > select cast( acct_id*-1 as char(29)) as new_acct_id
          > from   my_table
          > where  acct_id = 123775780
  Results in a string "-123775780." (without the quotes of course). I want the result returned without the trailing decimal point.  

  I'm using SQL Assistant and the column data type is DECIMAL(15,0) if that matters.  

     select -acct_id (format '-(15)9') (char(16))


  <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