#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    5
    Rep Power
    0

    Wrong number of arguments


    Hello,

    I am trying to write some very straight forward code. Searching for all records between a certain date. This is my code:

    select * from SALES_STAFF
    where DATE_HIRED between date('11/3/96 12:00AM') and date('8/18/1997 12:00AM')


    And I get an error about the arguments I am trying to pass. Is there something wrong with the date function I am using?

    Error number -239:

    DMS-E-GENERAL, A general exception has occurred during operation 'prepare request with options'.
    DMS-E-DBPARSER, The underlying database detected an error during processing of the SQL request.
    [Microsoft][ODBC Microsoft Access Driver] Wrong number of arguments used with function in query expression 'DATE_HIRED between date('11/3/96 12:00AM') and date('8/18/1997 12:00AM')'.


    Thank you!

    -rbon4
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    724
    Rep Power
    291
    Try this

    Code:
    select * from SALES_STAFF
    where DATE_HIRED between '11/3/96 12:00AM' and '8/18/1997 12:00AM'
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    5
    Rep Power
    0
    I tried that and it gives me a mismatched data type error.

    [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

    Thoughts?
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    724
    Rep Power
    291
    Not too sure.

    Check out this.
    http://www.techonthenet.com/sql/between.php
  8. #5
  9. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,203
    Rep Power
    4279
    try this

    Code:
    SELECT something
         , anything
         , just_not_the_dreaded_evil_select_star 
      FROM sales_staff
     WHERE date_hired BETWEEN #1996-11-03# AND #1997-08-18#
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    5
    Rep Power
    0
    YES

    It works! Thanks for your help guys

IMN logo majestic logo threadwatch logo seochat tools logo