我有varchar
数据类型列和date
数据类型列。
我必须将varchar
列数据更新为PostgreSQL中的date
列。
有可能吗?
感谢。
答案 0 :(得分:46)
ALTER TABLE <tablename> ALTER COLUMN <columnname> TYPE DATE
using to_date(<columnname>, 'YYYY-MM-DD');
答案 1 :(得分:6)
UPDATE tableName SET dateColumn=to_date(varcharColumn, 'DD MM YYYY')
假设您正在保存“07 04 2010”
您可以在文档中找到更多示例和说明:
http://www.postgresql.org/docs/current/interactive/functions-formatting.html
答案 2 :(得分:4)
to_date('05 Dec 2000', 'DD Mon YYYY')
答案 3 :(得分:1)
语法:
.listMenuChild {
list-style-image: url("../img/bg_li.png");
margin-top: 5%;
}
.listMenuChildActive {
list-style-image: url("../img/bg_li_h.png");
}
.listMenuChild:hover {
list-style-image: url("../img/bg_li_h.png");
}
从varchar转换为日期
<ul class="listMenuItem--s">
<li class="listMenuChildActive">
<a href="#" class="listMenuChild--title active">Dienstleistungen</a>
<ul class="sub-nav">
<li><a href="service/treuhandf.html" class="listMenuChild--subtitle">Treuhand & Finanzen </a></li>
<li><a href="service/wirtschaft.html" class="listMenuChild--subtitle">Wirtschaftsprüfung</a></li>
<li><a href="service/unternehmen.html" class="listMenuChild--subtitle">Unternehmensberatung / Nachfolge</a></li>
<li><a href="service/pension.html" class="listMenuChild--subtitle">Pensionierungs-, Vorsorge- und Steuerplanung</a></li>
<li><a href="service/informatik.html" class="listMenuChild--subtitle">Informatik</a></li>
</ul>
</li>
<li class="listMenuChild">
<a href="about.html" class="listMenuChild--title">Über uns</a>
</li>
<li class="listMenuChild">
<a href="publications.html" class="listMenuChild--title">Publikationen </a>
</li>
<li class="listMenuChild">
<a href="tools.html" class="listMenuChild--title">Hilfsmittel </a>
</li>
<li class="listMenuChild">
<a href="contact.html" class="listMenuChild--title">Kontakt / Lageplan </a></li>
</ul>