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:274434 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4