a purely MSSQL way would be
SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, DATEADD(yy, -1, GETDATE())))

since 2005 doesn't support that.


On Wed, Nov 14, 2012 at 11:02 AM, Leigh <cfsearch...@yahoo.com> wrote:

>
> > cast(dateadd('y', -1, getdate()) as date) as  -- getdate() in MSSQL
>
> I do not think 2005 supports the "date" type. A CF alternative is using
> dateAdd("yyyy", -1, now()) to get the date and time one year ago. Then use
> cfqueryparam with type "cf_sql_date" which automatically drops any time
> portion.
>
> -Leigh
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353164
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to