Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.DistanceBetweenPostCodes ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> create function "pears"."DistanceBetweenPostCodes"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in @PostCodeA char(20),in @PostCodeB char(20),in @Unit char(2) ) returns numeric(11,3) begin declare @EastingA numeric(11,3); declare @EastingB numeric(11,3); declare @NorthingA numeric(11,3); declare @NorthingB numeric(11,3); declare @Distance numeric(11,3); select first "Easting","Northing" into @EastingA,@NorthingA from "PostCodeLocation" where "PostCode" = "trim"(@PostCodeA); select first "Easting","Northing" into @EastingB,@NorthingB from "PostCodeLocation" where "PostCode" = "trim"(@PostCodeB); set @Distance = "sqrt"("power"("abs"(@NorthingA-@NorthingB),2)+"power"("abs"(@EastingA-@EastingB),2))/1000*if @Unit = 'Mi' then .621371192 else 1 endif; set @Distance = @Distance*cast("WPKMaintainGetSwitchValue"('POSTCODEMULT','GLOBAL','L') as double); return(@Distance) end </code> database/functions/pears_distancebetweenpostcodes.txt Last modified: 2026/08/07 19:24by 127.0.0.1