Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 17th, 2012, 12:19 PM
rbon4 rbon4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 5 rbon4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 32 sec
Reputation 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

Reply With Quote
  #2  
Old May 17th, 2012, 12:37 PM
Vomster's Avatar
Vomster Vomster is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 724 Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 2 h 26 m 31 sec
Reputation Power: 290
Try this

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

Reply With Quote
  #3  
Old May 17th, 2012, 12:50 PM
rbon4 rbon4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 5 rbon4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 32 sec
Reputation 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?

Reply With Quote
  #4  
Old May 17th, 2012, 01:05 PM
Vomster's Avatar
Vomster Vomster is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2005
Posts: 724 Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level)Vomster User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 2 h 26 m 31 sec
Reputation Power: 290
Not too sure.

Check out this.
http://www.techonthenet.com/sql/between.php

Reply With Quote
  #5  
Old May 17th, 2012, 01:55 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 26,357 r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level)r937 User rank is General 47th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 1 Week 2 Days 4 h 40 m 42 sec
Reputation Power: 4140
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#
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book

Reply With Quote
  #6  
Old May 17th, 2012, 02:11 PM
rbon4 rbon4 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 5 rbon4 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 35 m 32 sec
Reputation Power: 0
YES

It works! Thanks for your help guys

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Wrong number of arguments

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap