DatePart Function Missing
I am working on a simple query using DatePart. I am running CF9 on a Mac with MySQL. The code looks like this: CFQUERY name=GetAgentLeads datasource=#Application.Data# SELECT SoldID, LeadID, AgentID, ProfileID, FirstName, LastName, Price, Viewed, SoldDate FROM SoldLeads Where AgentID = #Session.AgentID# AND DatePart(,SoldDate)='#SearchYear#' /CFQUERY The code responds with FUNCTION Data.DatePart does not exist . Very similar code works with CFMX6 Access on a Windows machine. I have tried DatePart(,SoldDate)-'#SearchYear#' atePart('',SoldDate)-'#SearchYear#'. Nothing seems to work. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330321 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: DatePart Function Missing
I think you may be missing some pound symbols as I am not aware that MySql has a datepart function. Cheers, Dan On Feb 1, 2010, at 6:44 PM, Chad Veldhouse cveldho...@vaagency.com wrote: I am working on a simple query using DatePart. I am running CF9 on a Mac with MySQL. The code looks like this: CFQUERY name=GetAgentLeads datasource=#Application.Data# SELECT SoldID, LeadID, AgentID, ProfileID, FirstName, LastName, Price, Viewed, SoldDate FROM SoldLeads Where AgentID = #Session.AgentID# AND DatePart(,SoldDate) ='#SearchYear#' /CFQUERY The code responds with FUNCTION Data.DatePart does not exist . Very similar code works with CFMX6 Access on a Windows machine. I have tried DatePart(,SoldDate)-'#SearchYear#' atePart ('',SoldDate)-'#SearchYear#'. Nothing seems to work. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330322 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: DatePart Function Missing
I think you may be missing some pound symbols as I am not aware that MySql has a datepart function. Cheers, Dan On Feb 1, 2010, at 6:44 PM, Chad Veldhouse cveldho...@vaagency.com wrote: I may be misunderstanding you but the DatePart is a ColdFusion function (I believe)?. I copied the code from another working cfm.doc that is working on CFMX6 Windows with MS Access. I changed the variables but that is it. Am I missing something? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330323 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: DatePart Function Missing
I think you may be missing some pound symbols as I am not aware that MySql has a datepart function. Cheers, Dan On Feb 1, 2010, at 6:44 PM, Chad Veldhouse cveldho...@vaagency.com wrote: Maybe I am mis-understanding the functions. Is DatePart a function of MS Access? Is that why it wont work? If I use Extract it works. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330324 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: DatePart Function Missing
In the sample you posted, DatePart() is not surrounded by hashes (#). This means that you are calling the database's DatePart() function. Apparently MySQL does not have such a function, which is why you are receiving the error message. (I do not use MySQL, so you'd have to check their documentation to find the appropriate function(s) to use.) Conversely, if the code is actually #DatePart()#, then you would be calling a CF function. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330325 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: DatePart Function Missing
MySQL has a Year() function which would achieve what you want by the looks of it: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function _year Will -Original Message- From: Matt Quackenbush [mailto:quackfu...@gmail.com] Sent: 02 February 2010 02:30 To: cf-talk Subject: Re: DatePart Function Missing In the sample you posted, DatePart() is not surrounded by hashes (#). This means that you are calling the database's DatePart() function. Apparently MySQL does not have such a function, which is why you are receiving the error message. (I do not use MySQL, so you'd have to check their documentation to find the appropriate function(s) to use.) Conversely, if the code is actually #DatePart()#, then you would be calling a CF function. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:330326 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4