如何将长存储过程或查询分解为较小的查询. [英] how to break the long stored procedure or query into smaller queries.

查看:91
本文介绍了如何将长存储过程或查询分解为较小的查询.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行存储过程时,得到的消息为

SQL语句的某些部分嵌套得太深.重写查询或将其分解为较小的查询.


这是我的存储过程以及7个参数.

when i executing the stored procedure i got the message as

Some part of your SQL statement is nested too deeply. Rewrite the query or break it up into smaller queries.


This is my stored procedure along with 7 parametrs.

create proc procadvancedsearch(@keyword varchar(max)=null,@joblocation varchar(max)=null,@experience varchar(max)=null,@industry varchar(max)=null,@function varchar(max)=null,@role varchar(max)=null,@jobfreshbydays datetime=null)
as
begin
if(@keyword IS NOT  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,','))  and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%'
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%'  and joblocation in (select items from dbo.Split(@joblocation,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS  NULL and @joblocation IS  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT  NULL and @joblocation IS  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,','))  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NOT  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,','))  and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,','))
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%'  and joblocation in (select items from dbo.Split(@joblocation,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and  @experience between minexperience and maxexperience  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS  NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience  and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,',')) and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and  jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,',')) and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT  NULL and @joblocation IS  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT  NULL and @experience IS NOT NULL and @industry IS NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and  @experience between minexperience and maxexperience  and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  keyskills Like '%'+ @keyword+'%' and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where  joblocation in (select items from dbo.Split(@joblocation,','))  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NOT NULL and @experience IS NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and  joblocation in (select items from dbo.Split(@joblocation,','))  and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS NOT NULL and @joblocation IS NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where keyskills Like '%'+ @keyword+'%' and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else if(@keyword IS  NULL and @joblocation IS NOT NULL and @experience IS NOT NULL and @industry IS NOT NULL and @function IS NOT NULL and @role IS NOT NULL and @jobfreshbydays IS NOT NULL)
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid where joblocation in (select items from dbo.Split(@joblocation,','))  and @experience between minexperience and maxexperience and jobindustry in (select items from dbo.Split(@industry,',')) and jobfunctionality in (select items from dbo.Split(@function,',')) and  jobrole in (select items from dbo.Split(@role,',')) and jobposteddate between @jobfreshbydays and GETDATE()
end
else
begin
select e.jobtitle,e.jobposteddate,e.joblocation,e.minexperience,e.maxexperience,e.jobdescription, d.companyname from emppostingjobs e Inner join admregforemp d on e.comptypeid=d.comptypeid
end
END

推荐答案

This is one really huge stored procedure to read. Here are some basic guidelines you may want to follow:

1. Make use of functions for redundant queries. Call functions rather than re-writing same thing again and again.
2. Try to improve on your database design. Create relationships that may help to reduce the amount to code you need to write to get the data.
3. Think of an alternate logic ofr queries which is compact and efficient.

There can be few more ways to break it down.
This is one really huge stored procedure to read. Here are some basic guidelines you may want to follow:

1. Make use of functions for redundant queries. Call functions rather than re-writing same thing again and again.
2. Try to improve on your database design. Create relationships that may help to reduce the amount to code you need to write to get the data.
3. Think of an alternate logic ofr queries which is compact and efficient.

There can be few more ways to break it down.


这篇关于如何将长存储过程或查询分解为较小的查询.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆