DATEADD(YEAR, 1, @someDate) http://www.databasejournal.com/features/mssql/article.php/2216011 has a good primer on date manip for SQL server.
-Joe On Apr 3, 2007, at 10:41 AM, Chad Gray wrote: > 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/ > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:274435 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

