[英]AWS Athena query to find Date column has String or not satisfying timestamp format
I was testing Sprak 3 upgrades in AWS Athena and need to check date columns whether timestamp format is proper or not,Can any one please give me query to check whether date columns has any Values other than Timestamp format我正在 AWS Athena 中测试 Sprak 3 升级,需要检查日期列时间戳格式是否正确,任何人都可以给我查询以检查日期列是否具有时间戳格式以外的任何值
Assuming that you have a varchar
column you can try using date_parse
wrapped intry
:假设您有一个varchar
列,您可以尝试使用包装在try
中的date_parse
:
select *
from table
where try(date_parse(string_column, 'your_expected_format')) is null -- assuming no original nulls in column
Or via try_cast
for "standard" format:或者通过try_cast
获取“标准”格式:
select *
from table
where try_cast(string_column as timestamp) -- assuming no original nulls in column
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.