Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 17th, 2004, 02:12 PM
davefrisch davefrisch is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Iowa
Posts: 14 davefrisch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 m 55 sec
Reputation Power: 0
Exclamation Between Dates Parameters

I am trying to create a query that returns a set of results from a table. I have used the between statement in the Criteria field of the query as;

Between [Type the beginning date:] And [Type the ending date:]

However, when I type the dates into the pop-up boxes as 3/1/2004 and 3/15/2004, the results do not include 3/2-9/2004. It lists 3/1/2004 then skips to 3/10/2004 and shows dates until 3/15/2004. I need it to show all dates from the 1st through the 15th. What's wrong with this?

Reply With Quote
  #2  
Old March 17th, 2004, 05:50 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy
If you are using Access, then your dates in the query must be surrounded by the hash symbol (#).
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old March 18th, 2004, 12:24 PM
davefrisch davefrisch is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Iowa
Posts: 14 davefrisch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 m 55 sec
Reputation Power: 0
How should that look?

Reply With Quote
  #4  
Old March 18th, 2004, 04:49 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 8 m 57 sec
Reputation Power: 9
Send a message via ICQ to stumpy Send a message via MSN to stumpy

Reply With Quote
  #5  
Old March 19th, 2004, 12:06 PM
davefrisch davefrisch is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Iowa
Posts: 14 davefrisch User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 43 m 55 sec
Reputation Power: 0
Unhappy

What I want is for the query to ask for the dates to be entered. If I type the below in, it surely won't, right? But also, when I type this into the criteria section under the date field, it returns no values when clearly there are values for this criteria inclusively.
Between "#3/1/2004#" And "#3/15/2004#"

Reply With Quote
  #6  
Old September 23rd, 2004, 02:38 PM
aesparzav aesparzav is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 aesparzav User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
In SQL Server you can format dates as 'yyyymmdd', so you can script something like:

Between '20040301' and '20040315'

Reply With Quote
  #7  
Old November 10th, 2004, 03:45 PM
Makito Makito is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 4 Makito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I just did a query like this in SQL server... mine looked something like this:

SELECT col_1, col_2
FROM myTable
WHERE convert (datetime, convert (varchar, myTable.Date, 101), 101) >= @param1 AND convert (datetime, convert (varchar, myTable.Date, 101), 101) <= @param2

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Between Dates Parameters


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT