sql - Can I use full text search a row in a table where the condition is an array of values from a select query? -


i want create view , want full text search of row using set of keywords. these keywords exist in table in database.

so possible below can use select statement dynamically determine keywords filter on.

select * table1 contains(row1,  '[select k.name keywordcategory kc inner join keyword k on kc.keywordid = k.id kc.category in ('branda', 'brandb', 'brandc')]') 

the contains search condition cannot reference other tables, can around limitation constructing variable keywords.

-- build search condition, example: '"keyword1" or "keyword2" or "keyword3"' declare @searchcondition nvarchar(4000) select  @searchcondition = isnull(@searchcondition + ' or ', '') + '"' + k.name + '"' keywordcategory kc inner join keyword k on kc.keywordid = k.id kc.category in ('branda', 'brandb', 'brandc')  select  *    table1   contains(*, @searchcondition) 

you won't able in view though, have write function or stored procedure.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -