Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2003
    Posts
    32

    Question Unanswered: Search date field with 2 value

    when i create sql statment to query 2 date field using between command in asp or in EM, it doesn't give exactly result.

    SELECT *
    FROM loguser
    WHERE (log_date BETWEEN '05/16/2003' AND '05/16/2003')


    but the result only appeared when the statment more one day.
    SELECT *
    FROM loguser
    WHERE (log_date BETWEEN '05/16/2003' AND '05/17/2003')

    that means if i want to search for 05/20/2003 until 05/25/2003 (5 days) then i'll should place with 05/20/2003 until 05/26/2003. i think it's not good to beginner user or user who using my system.then how can i solve this problem

  2. #2
    Join Date
    Jan 2003
    Location
    India
    Posts
    523

    Re: Search date field with 2 value

    from BOL:
    A range search is one that returns all values between two specified values. Inclusive ranges return any values that match the two specified values. Exclusive ranges do not return any values that match the two specified values.

    The BETWEEN keyword specifies an inclusive range to search.

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i think it's not good to beginner user or user who using my system
    since date fields in sql server include times, you must do something, but you do not have to make your users enter the next date, just add one day to the end date they supply

    rudy

Posting Permissions

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