Ben,

Ok... Nicely done. What about "BETWEEN" ... Any benefits there?

WHERE date_created BETWEEN @date AND @date + 1

-Mark 

-----Original Message-----
From: Ben Nadel [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 03, 2007 9: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/



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274427
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to