Teradata date/time formats

How do you define your date/time formats in order to be able to use conditions? I have been using cast(date/time as date) on all of my date objects because date/time values don’t work as conditions, now I have to create a condition that includes both. When I try to use the date/time value straight up I get a Teradata error. I can get the exact error message if it helps; just wondering if you have some suggestions.


Dave Rathbun :us: (BOB member since 2002-06-06)

I apply the format of ‘yyyy-mm-dd HH:mm:ss’ to the object in Designer under database format.

I also format most of our timestamps to a date format because we do not need the timestamp for most queries. I had to figure this out for one project.

The only time I have been able to answer a question for Dave - I am going to save this thread in my favorites :slight_smile:


Michele Pinti (BOB member since 2002-06-17)

Well, I hate to be the bearer of bad news, but this didn’t fix my problem. :slight_smile: I have a date/time object that I have left as date/time (rather than casting to a date). I have added the format string as you provided it to the database format. I can run queries to retrieve the data just fine. But as soon as I try to use it in a condition I get errors.

Or

Did you have to configure anything outside of Business Objects, like the odbc driver or anything, to get this to work? Because it doesn’t seem to be happy with my changes. I’m using Designer XIR2 and Teradata 6.2 and building the queries in Webi.


Dave Rathbun :us: (BOB member since 2002-06-06)

Is the column defined as a timestamp in the database table?

If so, how about something like:

<Your Object> between Timestamp '3500-06-29 12:00:00' and Timestamp '3500-06-29 23:59:59'

anorak :uk: (BOB member since 2002-09-13)

I am positive that we have not done any changes to ODBC driver. I am still on version 6 in Webi and probably a different odbc driver (3.0.3). It is starting to sound like a bug if you can use it as a result object. Are you prompting for the date or just using it as a condition?


Michele Pinti (BOB member since 2002-06-17)

anorak, that is one of the formats I tried. I entered the date/time in exactly the same format that I included in Designer as the formatting.

If I enable the LOV for the object and pick from the list I get the same error.

Michele, it doesn’t matter if I prompt or enter the date/time as a constant. I get errors either way.

I will confirm what the actual database column is, whether it is a date/time, timestamp, or what. When I apply a cast as date everything works perfectly, but I need to be able to apply a condition from 8:00 AM to 8:00 AM rather than midnight to midnight… :? … and that means being able to apply a time value to the date/time condition.


Dave Rathbun :us: (BOB member since 2002-06-06)

Let me pull up my report and double check the format. I’ll get back to you this morning.


Michele Pinti (BOB member since 2002-06-17)

Dave,

Have you seen this?

https://bobj-board.org/t/22976/3


anorak :uk: (BOB member since 2002-09-13)

I had not. However, I am guilty of doing what many folks do… I didn’t do exactly what Michele suggested earlier. :slight_smile: Here is what she said to do:

Here is the format string I put into Designer:

yyyy-mm-dd HH:mm:ss

See the difference? :wink:

When I did exactly what Michele suggested it appears to work. At least so far, testing continues.


Dave Rathbun :us: (BOB member since 2002-06-06)

I can confirm that Michele’s solution works exactly as it should, but only if you follow it precisely. :slight_smile: If you missed the difference between what I was told to do and what I did in the prior post… well, the quotes are a required part of the date/time format string. If you leave the quotes out it does not work. Putting the quotes in and so far everything I have tried to run has worked flawlessly.

Thanks, Michele. :slight_smile:


Dave Rathbun :us: (BOB member since 2002-06-06)

I am glad you figured it out. 8)


Michele Pinti (BOB member since 2002-06-17)