在开发环境和UAT环境中,使用同一个sql查询,开发环境中报错,而UAT环境却正常。
sql:select * from table_name where to_cahr(trans_date,'yyyy-mm') > '2016-01'
其中,trans_date是varchar型,存储的数据格式为“2016-08-01“。
在开发环境中报错信息:
SQL0180N The systax of the string representation of a datetime value is incorrect.
SQLSTATE=22007
很疑惑,两个环境的数据库环境、版本、配置都基本一致,为什么同一条sql在UAT
正常运行,在开发环境却出现问题?