ISDATE equivalent in Vertica

ISDATE equivalent in Vertica

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 

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.