TIMESTAMP in WHERE clause returns all rows in table

Database
New Member

TIMESTAMP in WHERE clause returns all rows in table

Hello - 

 

This query is running with the TDCH, however I don't think it's an issue with that tool.

 

I have a table with a column:

LOAD_TIMESTAMP TIMESTAMP(0)

 

All values in this column are in 1970. 

 

When I query the table with:

LOAD_TIMESTAMP > TIMESTAMP '2000-01-01 00:00:00' AND LOAD_TIMESTAMP < TIMESTAMP '2017-12-31 23:59:59'

 

It returns 0 rows, which is expected

 

When I just change the last datetime value to 2018: 

LOAD_TIMESTAMP > TIMESTAMP '2000-01-01 00:00:00' AND LOAD_TIMESTAMP < TIMESTAMP '2018-12-31 23:59:59'

 

ALL rows in the table are returned. 

 

Does this behavior make sense at all?

Tags (2)
1 REPLY 1
Teradata Employee

Re: TIMESTAMP in WHERE clause returns all rows in table

Hi smccormick23,

 

Well, no, that's a very strange behaviour.

Can you run the following query in BTEQ / SQLA / Studio ?

  select extract(year from LOAD_TIMESTAMP) as load_year
       , count(*)                          as nb_rows
    from <YourTable>
group by 1;

Also, can you capture the query issued by TDCH in dbc.DBQLogTbl ?