Sunday, July 14, 2019

Procedure Parameter in where condition

WHERE (IsInterviewed = 0 OR IsInterviewed is null) 
AND ISNULL([Corporate-ShortListStatusForInterview],0) IN (2,3) -- Consolidated Candidate AND ((@strDistrictIds IS NOT NULL AND FK_DistrictId   IN (SELECT [ID] FROM  dbo.SplitIDs(@strDistrictIds))) OR (@strDistrictIds IS NULL))

AND(
((LEN(@Keywords) > 0 AND CP.FirstName  LIKE '%' + @Keywords + '%') OR (@Keywords IS NULL OR LEN(@Keywords) = 0))
OR ((LEN(@Keywords) > 0 AND CP.MiddleName LIKE '%' + @Keywords + '%') )
)
AND ((@ProgramId    IS NOT NULL AND P.ProgramId = @ProgramId)  OR (@ProgramId   IS NULL))

No comments: