Mathematical operation like this could be detrimental to SQL's performance - you would have to run test on this....I reckon I this case a CFC would be better placed for memory intensive operations.
-----Original Message----- From: Ken [mailto:[EMAIL PROTECTED] Sent: 02 December 2005 22:57 To: CF-Talk Subject: Stored Proc Hi guys. As they say in CF good practices. Make your database do the work for you. I have a CFC with this function below. I need to make it into a stored procedure. The function is: <cffunction name="LatLonDist" returntype="numeric" access="public"> <cfargument name="lat1" type="numeric" required="true"> <cfargument name="lon1" type="numeric" required="true"> <cfargument name="lat2" type="numeric" required="true"> <cfargument name="lon2" type="numeric" required="true"> <cfargument name="units" type="string" required="true"> <cfset var myResult = 0> <CFIF (arguments.lat1 GT 90 OR arguments.lat1 LT -90 OR arguments.lon1 GT 180 OR arguments.lon1 LT -180 OR arguments.lat2 GT 90 OR arguments.lat2 LT -90 OR arguments.lon2 GT 280 OR arguments.lon2 LT -280)> <cfset myResult = 0> <cfelse> <cfset lat1 = arguments.lat1 * pi()/180> <cfset lon1 = arguments.lon1 * pi()/180> <cfset lat2 = arguments.lat2 * pi()/180> <cfset lon2 = arguments.lon2 * pi()/180> <cfset UnitConverter = 1.150779448> <cfif arguments.units eq 'nm'> <cfset UnitConverter = 1.0> </cfif> <cfif arguments.units eq 'km'> <cfset UnitConverter = 1.852> </cfif> <cfset distance = 2*asin(sqr((sin((arguments.lat1-arguments.lat2)/2))^2 + cos(arguments.lat1)*cos(arguments.lat2)*(sin(( arguments.lon1-arguments.lon2)/2))^2))> <cfif arguments.units neq 'radians'> <cfset distance = UnitConverter * 60 * distance * 180/pi()> </cfif> <cfset myResult=distance> </CFIF> <cfreturn myResult> </cffunction> Thanks, K ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:226060 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

