Thanks Ben, and Joe here is what finally worked for me. dateCreated >= '04/03/2007' AND dateCreated < DATEADD(DAY, 1, '04/03/2007')
With dateCreated >= '04/03/2007' AND dateCreated < ('04/03/2007' + 1) I get this error: Conversion failed when converting the varchar value '04/03/2007' to data type int. So I probably have to cast as a date in order to get this to work. -----Original Message----- From: Joe Rinehart [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 03, 2007 10:48 AM To: CF-Talk Subject: Re: SQL question Chad, Try WHERE dateCreated >= @someDate AND dateCreated < DATEADD(DAY, 1, @someDate) -Joe On Apr 3, 2007, at 10:45 AM, Chad Gray wrote: > I just tried this and I get no records. > > dateCreated >= 04/02/2007 AND dateCreated < (04/02/2007 + 1) > > Is this method compatible with MS SQL? > > > > > -----Original Message----- > From: Chad Gray [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 03, 2007 10:41 AM > To: CF-Talk > Subject: RE: SQL question > > On the (@date + 1) how do you know it is adding one day? > > Out of curiosity how do you add one year? > > Thanks for the clean elegant solution. I will try it out. > > > -----Original Message----- > From: Ben Nadel [mailto:[EMAIL PROTECTED] > Sent: Tuesday, April 03, 2007 10:26 AM > To: CF-Talk > Subject: RE: SQL question > > People people people :) > > I have seen casting, converting, date-diffing, LIKE'ing, > MONTH()/Day()/Year()'ing.... Please do not run functions on your > date/time fields. Running a function on a column in general is > extremely > slow. Date/time stamps can be used quite nicely with out them: > > DECLARE @date DATETIME; > SET @date = '04/14/2006'; > > SELECT * > FROM [TABLE] > WHERE > date_created >= @date > AND > date_created < (@date + 1) > > > Notice that I comparing the "date_created" to the set date and also > that > it is LESS than the set date PLUS one (the next day). This is going to > perform a 100 times better than any function you call on the date > column. > > ........................ > Ben Nadel > Certified Advanced ColdFusion MX7 Developer > www.bennadel.com > > Need ColdFusion Help? > www.bennadel.com/ask-ben/ > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274439 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4