Full text search isn't working if I pass only o开发者_如何学编程ne letter as the param
DECLARE @search_param NVARCHAR(250)
SET @search_param = 'a'
SELECT TOP 500
[KEY] AS id,
[RANK] AS relevance
FROM CONTAINSTABLE(table_name, column_name, @search_word)
ORDER BY 2 DESC, 1 desc
If only one letter is passed I need it to select only sentences that start with that letter.
Use 'a*' to search for "begins with a"
DECLARE @search_param NVARCHAR(250) SET @search_param = 'a'
-- if only one letter is passed
-- i need it to select only sentences that start with that letter
if len(@search_param) = 1 set @search_param = '"' + @search_param + '*"'
SELECT TOP 500
[KEY] AS id,
[RANK] AS relevance
FROM CONTAINSTABLE(table_name, column_name, @search_param)
ORDER BY 2 DESC, 1 desc
精彩评论