====== pears.BroadBeanCreatePost ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."BroadBeanCreatePost"( in @Instance char(20),in @JobTitle char(65),in @Industry char(100),in @JobType char(9),in @VacancyID char(20),in @BroadbeanLocationID integer,in @JobRef char(20),in @Duration char(30),in @StartDate char(30),in @Salary_From integer,in @Salary_To integer,in @Salary_per char(5),in @Salary_Benefits char(50),in @Skills char(65),in @Description char(2500),in @Secure char(1) )
returns long varchar
begin
declare "URL" long varchar;
declare @UserName char(100);
declare @Password char(100);
declare @Location1 char(100);
declare @Location2 char(100);
declare @Location3 char(100);
declare @BoardList char(8000);
select "UserName","Password" into @UserName,@Password from "BroadBeanUser" where "StaffID" = "UserStaffID";
select "Level1","Level2","Level3" into @Location1,@Location2,@Location3 from "BroadBeanLocation" where "BroadBeanLocationID" = @BroadbeanLocationID;
select "list"("string"('&destination_',"code",'=on'),'') into @BoardList from "TTBroadBeanBoardsToPostTo" where "Instance" = @Instance and "Selected" = 1;
set "URL" = "string"('http',
if @Secure = 'T' then 's' else null endif,
'://www.adcourier.com/broadcast-step-2.cgi?','username=',
"urlsafe"(@UserName),'&password=',
"urlsafe"(@Password),
@BoardList,'&jobtype=',
"urlsafe"(@JobType),'&jobref=',
"urlsafe"(@JobRef),'&duration=',
"urlsafe"(@Duration),'&startdate=',
"urlsafe"(@StartDate),'&salary_from=',
"urlsafe"(@Salary_From),'&salary_to=',
"urlsafe"(@Salary_To),'&salary_per=',
"urlsafe"("lower"(@Salary_per)),'&salary_benefits=',
"urlsafe"(@Salary_Benefits),'&location_1=',
"urlsafe"(@Location1),'&location_2=',
"urlsafe"(if @Location2 = @Location3 then @Location2
else "string"('--',@Location3)
endif),'&jobtitle=',"urlsafe"(@JobTitle),'&industry=',
"urlsafe"(@Industry),'&skills=',
"urlsafe"(@Skills),'&description=',
"urlsafe"(@Description));
return "URL"
end