====== pears.PersonVacancyShiftMatch ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."PersonVacancyShiftMatch"( in @PersonID char(20),in @VacancyID char(20) ) returns double begin declare "rv" double; set "rv" = "DistanceBetweenPostCodes"( (select "Person"."PostCode" from "Person" where "Person"."PersonID" = @PersonID), (select "isnull"("vacancy"."postcode","company"."postcode") from "Vacancy" key join "Employment" key join "Company" where "Vacancy"."VacancyID" = @VacancyID),'Mi'); if "rv" < 1 then return "round"("rv",1) else return "round"("rv",0) end if end