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.GenerateKeyname ====== <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"."GenerateKeyname"( in "x" char(100) ) returns char(100) begin declare "w1" char(100); declare "wn" char(100); declare "c" char(1); declare "i" integer; set "x" = "trim"("x"); set "i" = "charindex"("char"(32),"x"); if "i" > 0 then set "w1" = "left"("x","i"-1); if "w1" in( 'mr','ms','miss','mrs','mr.','ms.','mrs.' ) then set "x" = "right"("x","length"("x")-"i") end if end if; set "i" = "length"("x"); "loop1": loop set "c" = "substr"("x","i",1); if "c" = "char"(32) then return "makekeyname"("right"("x","length"("x")-"i")+' '+"left"("x","i"-1)) end if; set "i" = "i"-1; if "i" <= 0 then leave "loop1" end if end loop "loop1"; return "x" end </code> database/functions/pears_generatekeyname.txt Last modified: 2026/08/07 19:24by 127.0.0.1