Hi,
I'm trying to insert current date, and current time into the following table and seems having formatting issues.
Could you provide examples how to format to enter values into DATE and TIMESTAMP columns using CAST or TO_CHAR functions.
create table t1 (dt DATE, ts TIMESTAMP);
insert into (CURRENT_DATE, CURRENT_TIMESTAMP);
Column "ts" is of type timestamp but expression is of type timetz
HINT: You will need to rewrite or cast the expression
Vertica date/time function format
Moderator: NorbertKrupa
-
- GURU
- Posts: 527
- Joined: Tue Oct 22, 2013 9:36 pm
- Location: Chicago, IL
- Contact:
Re: Vertica date/time function format
It seems like your issue is the INSERT syntax and missing parentheses on CURRENT_DATE. Also note that unless you're specifying precision, CURRENT_TIMESTAMP does not use parentheses.
Code: Select all
dbadmin=> INSERT INTO t1 (dt, ts) VALUES (CURRENT_DATE(), CURRENT_TIMESTAMP);
OUTPUT
--------
1
(1 row)
dbadmin=> SELECT * FROM t1;
dt | ts
------------+----------------------------
2014-04-22 | 2014-04-22 15:08:55.334903
Checkout vertica.tips for more Vertica resources.