CAST和操作符postgresql错误

时间:2014-07-19 12:54:08

标签: sql postgresql concatenation

我试图以这种格式创建日期:2014-04-01。在Transact SQL中,我将此查询考虑到了' 04-2014'有一个类型日期。

SELECT CAST('01-'+'04-2014'  AS Date) 

当我在PostgreSQL中做同样的事情时,我有这个错误:

ERROR:  operator does not exist: unknown + character varying
LINE 2:      CAST('01-'+'04-2014'  AS Date) 
                   ^
HINT:  No operator matches the given name and argument type(s). 
You might need to add explicit type casts.

我可以做些什么来在Postgres中获得相同的结果?

0 个答案:

没有答案