Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 25th, 2003, 06:58 PM
Registered User
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default sql for searching in between given dates

What sql query is used to search for records falling betn two dates given.

eg. betweenn 7/20/2002 and 7/25/2003
    my date field has dates in this format 7/23/2003 4:03:09 AM



 
Old July 26th, 2003, 10:23 AM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to vinyl-junkie
Default

Here's how to set up your Where clause:

DateRange >= #7/20/02 4:03:09 AM#
AND DateRange <= #7/23/03 4:03:09 AM#

The whole trick is putting the # sign before and after the date/time string. I notice my databases leave off the century in the date/time field, so I don't know if you need to exclude that or not. You might try and see.

Hope this helps. :)

Pat Wong
http://www.napathon.net/ - Music Around The World
For collecting tips, trade and want lists, album reviews and more.





Similar Threads
Thread Thread Starter Forum Replies Last Post
help with this searching sql condition problems kumiko SQL Language 10 January 11th, 2008 07:49 PM
help with SQL dates Byock SQL Server 2000 1 March 23rd, 2006 12:58 PM
Getting Dates in SQL meichmann SQL Server 2000 5 April 18th, 2005 10:58 AM
SQL dates in American lic023 Access VBA 4 July 8th, 2004 03:06 AM
International Dates in SQL owain SQL Language 2 June 13th, 2003 03:12 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.