Pervasive
Sign in | Join | Help
in

TIMESTAMPADD not working

Last post 07-03-2008 8:22 AM by billegge. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 07-02-2008 3:45 PM

    TIMESTAMPADD not working

    This works

    select
      TIMESTAMPADD(
        SQL_TSI_MONTH,
        -1,
        {d '2008-03-30'}
      ) as Added

     but this does not

    select
      TIMESTAMPADD(
        SQL_TSI_MONTH,
        1,
        {d '2008-01-30'}
      ) as Added

     

    The only difference is subtraction.

    I am using Pervasive 8.70.014.000

  • 07-02-2008 5:55 PM In reply to

    Re: TIMESTAMPADD not working

    - What do you mean by "doesn't work"?

    - Have you tried with other (newer) versions?  I tried v10.10 and the one you said doesn't work returns 2/29/2008. 

     

    Mirtheil
    I do not answer question via email. Please post questions in the forum.
  • 07-03-2008 4:25 AM In reply to

    • Gordon
    • Top 50 Contributor
    • Joined on 08-30-2007
    • Delft, The Netherlands
    • Posts 93

    Re: TIMESTAMPADD not working

    He? That's silly....

    select
      TIMESTAMPADD(
        SQL_TSI_MONTH,
        1,
        {d '2008-01-29'}
      ) as Added

    Works Party!!!

    select
      TIMESTAMPADD(
        SQL_TSI_MONTH,
        1,
        {d '2009-01-29'}
      ) as Added

    Does not work Hmm

     
    What happens is that it actually does increase the month by one but then applies the same day to it resulting in an invalid date. Really strange though that it *does* correct the day if you're subtracting.
     

  • 07-03-2008 8:00 AM In reply to

    Re: TIMESTAMPADD not working

     When I try with v10.10, the query:

    select
      TIMESTAMPADD(
        SQL_TSI_MONTH,
        1,
        {d '2009-01-29'}
      ) as Added

    returns:

    Get Data All:
    "Added"
    2009-02-28 00:00:00.0000000
    1 row fetched from 1 column.

     

    I haven't tried with v8.  

    Mirtheil
    I do not answer question via email. Please post questions in the forum.
  • 07-03-2008 8:21 AM In reply to

    Re: TIMESTAMPADD not working

    I tried v9.50.077 and v8 and the error in evaluation was in both.  After applying the latest service pack on version 9 the problem was resolved.

     

    Jose

  • 07-03-2008 8:22 AM In reply to

    Re: TIMESTAMPADD not working

    I get an error saying Invalid Date.  I would like to upgrade to a newer version of Pervasive but the problem is that we have software that has not been tested with v10, the software is 3rd party.

    My solution is this:  Note 1200 must not be a partial year, in this case it is 100 years, to ensure the ADD part works (it lands on the same month so it should never have the problem unless its Feb 29).

    TIMESTAMPADD(
      SQL_TSI_MONTH,
      (xyz)-1200,
      TIMESTAMPADD(SQL_TSI_MONTH, 1200, AnnDate)
    )

Page 1 of 1 (6 items)
© 2008 Pervasive Software Inc. All Rights Reserved.