繁体   English   中英

用于查找日期列的 AWS Athena 查询具有字符串或不满足时间戳格式

[英]AWS Athena query to find Date column has String or not satisfying timestamp format

我正在 AWS Athena 中测试 Sprak 3 升级,需要检查日期列时间戳格式是否正确,任何人都可以给我查询以检查日期列是否具有时间戳格式以外的任何值

假设您有一个varchar列,您可以尝试使用包装在try中的date_parse

select *
from table 
where try(date_parse(string_column, 'your_expected_format')) is null -- assuming no original nulls in column

或者通过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.

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