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 March 16th, 2004, 08:23 AM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default SELECT LIKE on DATE fields

My first ever post!! - although I often look here for solutions.

Can't find any help on this one:

I am trying to select all records from an orders table where the date is equal in part to an entered date. ie.

SELECT SUM (Order_Price) AS PRICE, SUM (Order_Quantity) AS QTY
FROM DayQuery
WHERE CourierID = passed4 AND Order_Category = '4' AND OrderDateTime LIKE passeddate%

User posts passeddate: '16/mar/04' or '16/03/2004'

My database has the date stored as '16/03/2004 10:29:01' and come back with no records.

I would like it to return all orders on that date irrespective of the time. I also don't really want to put the order time in a separate field. Any ideas ??

I have thought about using LIKE #16/03/04%# but the syntax is incorrect - am I opn the right tracks ??

 
Old March 16th, 2004, 11:22 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

Maybe this will help you out in some way...

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%
date_string = "10-03-2004"
date_parts = Split(date_string, "-")

            day_part = date_parts(0)
            month_part = date_parts(1)
            year_part = date_parts(2)
    X = day_part & "/" & month_part & "/" & year_part
    response.write(X)

%>

Such is Life!
 
Old March 16th, 2004, 11:43 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 141
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to acdsky
Default

P.S...U could use " " as the value for the split as well if you want to split the date and time value and load it into a variable(If they seperated by a blank)

Maybe first write the date separately in a temp table and then run the query or loop through the recordset: split, check and if not equal to users input movenext, loop.

Hope this helps





Similar Threads
Thread Thread Starter Forum Replies Last Post
Select fields & calculating age miki-pt Access ASP 1 November 26th, 2006 06:16 PM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM
FlexGrid and Date Fields BowlingKaz Pro VB Databases 4 September 28th, 2004 08:50 AM
SELECT LIKE on DATE fields borami Classic ASP Databases 0 March 16th, 2004 08:20 AM





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