将varchar日期(BC& AD)转换为sql中的日期格式

时间:2016-12-03 18:30:20

标签: sql postgresql date varchar

日期将像这样存储在另一个表中作为varchars

select wkdocre from works;
   wkdocre   
-------------
 +1654/12/31
 +1706/12/31
 +1667/12/31
 -0332/12/31
 -0332/12/31
 -1295/12/31

我想将这些日期插入到另一个表中,其属性类型为date,如此

update ns_works set wor_workcreationdate=(select wkdocre from works where wor_workcreationdate=wkdocre);

我收到此错误

ERROR:  operator does not exist: ns_workcreationdate = dateofcreation
LINE 1: ...lect wkdocre from works where wor_workcreationdate=wkdocre);
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

感谢您

期望的结果

select wor_creationdate from ns_works;
   wor_creationdate   
-------------
 1654/12/31
 1706/12/31
 1667/12/31
 -0332/12/31
 -0332/12/31
 -1295/12/31

0 个答案:

没有答案