akatz66
asked on
teradata - pulling time information from datetime field
Hello,
I am trying to pull out the time from a datetime field and I'm having some trouble. It's fairly easy to do with the date and I'm not sure what I'm doing wrong. An example of the field is :
2008-08-29 13:05:00
To pull a date, I use the following code:
WHERE
(CAST(tablename.fieldname AS DATE) BETWEEN {(alias) '2010-06-01'} AND {(alias) '2011-04-30'})
I am trying to pull out the time from a datetime field and I'm having some trouble. It's fairly easy to do with the date and I'm not sure what I'm doing wrong. An example of the field is :
2008-08-29 13:05:00
To pull a date, I use the following code:
WHERE
(CAST(tablename.fieldname AS DATE) BETWEEN {(alias) '2010-06-01'} AND {(alias) '2011-04-30'})
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.