简体   繁体   English

Teradata中的日期转换

[英]date conversion in teradata

I am using this query select * from temp where cast (DateStart as varchar(12)) 我正在使用此查询select * from temp where cast(DateStart as varchar(12))

so if we count this for today it should give records with date less than '2014-07-17' 因此,如果我们今天将其计算在内,则应提供日期小于“ 2014-07-17”的记录

but the above query is giving all records even the records with date greater than the above given date. 但是上面的查询会提供所有记录,即使日期大于上面给定日期的记录也是如此。

datatype datestart : varchar(10) 数据类型datestart:varchar(10)

how can I convert above to give records only less than the calculated date? 我如何才能在上面进行转换以仅提供少于计算日期的记录? thanks. 谢谢。

i got a solution for this it was converting all date like 1914 instead of 2014 and that is why returning all records. 我为此得到了一个解决方案,它像1914年而不是2014年那样转换了所有日期,这就是为什么返回所有记录的原因。 So solution is : cast ( DateStarted as date format 'mm/dd/yy') + INTERVAL '100' YEAR 所以解决方案是:强制转换(DateStarted为日期格式'mm / dd / yy')+ INTERVAL'100'YEAR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM