Netezza Performance Server

 View Only
  • 1.  Displaying Date-Time Field.

    Posted Thu May 26, 2022 03:07 PM
    All three of these SELECT's return the same value - 1/1/2010 12:00:00 AM.  


    SELECT DATETIME('2010-01-01') as start_date;
    SELECT (DATETIME '2010-01-01') as start_date;
    SELECT CAST('2010-01-01' AS TIMESTAMP) as start_date;

    Is there any preference for one over the other two?  



    ------------------------------
    David Briars
    ------------------------------

    #NetezzaPerformanceServer


  • 2.  RE: Displaying Date-Time Field.

    Posted Fri May 27, 2022 12:08 PM
    Hello David,

    Internally above query are using timestamp function. For end user it does not matter what way one uses / calls the function, but using CAST('2010-01-01' AS TIMESTAMP) makes obvious sense.


    ------------------------------
    Sachin Jain
    APD Team Lead - Netezza and IIAS
    ------------------------------



  • 3.  RE: Displaying Date-Time Field.

    Posted Tue May 31, 2022 11:47 AM
    Thank you for your thoughts Sachin. 

    Yep, I'll go ahead and use the CAST in my code.

    ------------------------------
    David Briars
    ------------------------------