Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Tue, 31 Oct 2012 @ 01:39:31 GMT

  <Prev Next>   <<First <Prev

Subj:   Re: Date conversion not working
From:   McCall, Glenn David

My suggestion does not seem to have come through so I am reposting.

Have you tried this using bteq (this is important - please try it)?

The query seems to work for me. The two levels of cast are not required. One problem that I initially had was that I put the ****WRONG**** value in my vc column. As such the where clause did not work because my emp_dt value was not todays date. Quadruple check the format and value of emp_dt.

It is only necessary to have one cast (the vc to date). It is not necessary to cast the date to a date because it is already a date. It is also not necessary to quote the declaration of "dt" as this is not a reserved word.

Thus this should be sufficient:

       cast(emp_dt as date format 'mm/dd/yyyy') dt from tblname where dt = current_date

I also tried this:

       cast(emp_dt as date format 'mm/dd/yyyy') dt,
       dt - current_date
     from tblname

To see what was happening.

Hope this helps

Glenn Mc

  <Prev Next>   <<First <Prev
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020