ISDATE equivalent in Vertica
Hi
Below is an example for the new casting capability vertica has SELECT a::!int FROM mytable;
The above casting simulte is_numeric() function and return null if the value is not numeric , you can do the same test with date or timestamp
In the below example you can see that when the value is not a date , the return value is null :
dbadmin=> create table t3 (s varchar(20));
CREATE TABLE
dbadmin=> insert into t3 values('2012-10-10');
OUTPUT
--------
1
(1 row)
dbadmin=> insert into t3 values('abc');
dbadmin=> SELECT s::!timestamp from t3;
s
---------------------
2012-10-10 00:00:00
(2 rows)
Thanks
Comments
Hi
Below is an example for the new casting capability vertica has
SELECT a::!int FROM mytable;
The above casting simulte is_numeric() function and return null if the value is not numeric , you can do the same test with date or timestamp
In the below example you can see that when the value is not a date , the return value is null :
dbadmin=> create table t3 (s varchar(20));
CREATE TABLE
dbadmin=> insert into t3 values('2012-10-10');
OUTPUT
--------
1
(1 row)
dbadmin=> insert into t3 values('abc');
OUTPUT
--------
1
(1 row)
dbadmin=> SELECT s::!timestamp from t3;
s
---------------------
2012-10-10 00:00:00
(2 rows)
Thanks