Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Location
    Brussels
    Posts
    57

    Unanswered: datetime +- inbtervals

    How to calculate CORRECTLY with intervals :

    when the date1 = '31/01/2006'
    then "select date1 - 1 units month .. " results in '31/12/2005'
    tht's fine

    but
    with " select date1 - 2 units month .. " results in
    " The result of a datetime computation is out of range"
    because '31/10/2005' doesn't exists

    the same with "31/01/2006" + 1 units month
    How to calculate correctly ??
    Yves & Willy

  2. #2
    Join Date
    Nov 2004
    Posts
    143
    Hi,

    If you are concerned with only last dates of the month, then may be you can use the following:

    select -- n months previous end day (eg below is 4 months) -- ( biggest frig comparred to the others)
    current year to day -3 units month - (day(current)) units day as prevN_month_end

    from systables
    where tabname = 'systables'


    Bye

    Nitin

  3. #3
    Join Date
    Apr 2004
    Location
    Brussels
    Posts
    57
    Hi,

    yes, like to be a ,right answer.

    Thanks
    Yves
    Yves & Willy

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •