====== pears.getword ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."getword"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "s1" long varchar,in "ln1" smallint ) returns char(200) begin declare "i" smallint; declare "ln" smallint; declare "s" char(200); set "ln" = "ln1"; set "s" = "s1"; "loop1": loop set "ln" = "ln"-1; if "ln" <= 0 then leave "loop1" end if; set "i" = "charindex"("char"(32),"s"); if "i" > 0 then set "s" = "stuff"("s",1,"i",'') else set "s" = '' end if end loop "loop1"; set "i" = "charindex"("char"(32),"s"); if "i" > 0 then set "s" = "left"("s","i"-1) end if; return("s") end