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.PostCodePart ====== <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"."PostCodePart"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "postcode" char(20),in "part" char(20) ) returns char(20) deterministic begin declare "i" integer; declare "area" char(20); set "postcode" = "trim"("postcode"); set "i" = "patindex"('%[0-9]%',"postcode"); if "i" = 0 then return null end if; set "area" = "substr"("postcode",1,"i"-1); if "part" = 'area' then return "area" end if; set "postcode" = "stuff"("postcode",1,"i"-1,null); set "i" = "patindex"('%[^0-9]%',"postcode"); if "part" = 'district' then return "area"+"left"("substr"("postcode",1,"i"-1),2) end if end </code> database/functions/pears_postcodepart.txt Last modified: 2026/08/07 19:24by 127.0.0.1