Sounds like you are using SQL Server.

This is expected behavior because 6/30/2003 01:01:01.01 is greater than
6/3/2003 00:00:00.03 (think that's right).  The second one is what you are
creating.

I believe that what you really want is :

Select *
from transactions
where bDate >= #variables.EDate#
and bDate < #Variables.CDate#

but set EDate = today not yesterday.

Steve


-----Original Message-----
From: Tony Gruen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 01, 2003 11:56 AM
To: CF-Talk
Subject: Little OT: SQL Query Date Filter


I have been testing this and cannot envision a solution. SQL Server 2000 and
CF5.

I have a small table that records transactions. The date for each
transaction is recorded in createodbcdatetime format. Transactions can occur
throughout the day.

I am creating a page that shows the days transactions. The user enters a
date in mm/dd/yyyy format to query the db.
Trouble in that witht he query below when I enter 07/01/2003 I get
transactions from 06/30/2003 as well.

<CFSET CDate = "#createodbcdate(form.RptDate)#"> (this is what the user
enters as the desired date for the report)
<CFSET EDate = DateAdd('d', -1, CDate)> (yesterday's date)
<CFSET TDate = DateAdd('d', 1, CDate)> (tomorrows date)

SELECT *
FROM Transactions
WHERE bDate > #variables.EDate#
AND bDate < #variables.TDate#

Thank you in advance for your brainpower - is my method off somehow?

Tony Gruen




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to