I’ve created a view which grabs all the datas from multiple tables and I need to do a keywordsearch on it.Below is my SP where I join my View and keyword function which does the search on description,name,items,products.My issue here is if items has null value or products have null value it dosen’t return the rows.I need to show the result even if item or products is null.I tried using left outer join,it shows all the rows irrelevant to my search keyword.I tried different approachs like using where clause items is null and products is null,no luck.I need some expert advice to handle this.
ALTER PROCEDURE [dbo].[keywordsearch]
(
@username varchar(256),
@keyword varchar(250)
)
AS
BEGIN
select * from allrecordsview k join dbo.Split(@Keyword, ',')T on
k.description+k.Name+k.items +k.products like '%' + T.items + '%'
where k.username = @username
END
Try this: