Hi
I have a search ui with 3 all optional search criteria. 2 of them are simple criteria for a where statement, that I should be able to solve with this: http://stackoverflow.com/questions/697671/stored-procedure-with-optional-where-parameters.
The last criterion is using full text search where I join the result from ContainsTable. Is there some trick I can use to put everything in one stored procedure? Or should I make two queries, one with the full text search and one without?
Edited: I should have put my query here as well, sorry here it is
select Table1.* from Table1
join
(
select [Key], SUM(Rank) as Rank from
(
SELECT [Key], Rank*3 as Rank FROM Table1ShortSearch(@Keywords) union all
SELECT [Key], Rank*2 as Rank FROM Table1LongSearch(@Keywords)
) as RankingTbl
group by [Key]
) as r
on Table1.Id = r.[Key]
where ( @Status_Id Is Null Or Status_Id = @Status_Id )
order by r.Rank Desc
Thanks.