Consulta de tabla de texto libre

I have written an sql query to search 2 columns of a database, partNo and Description and it works fine for searching descriptions however if you search for a part number such as 164 it picks up all of the part numbers which start with 164 such as say: 164-20 but it doesn't pickup results like say APS164-20

here is my sql code, I am running mssql 2005.

SELECT FT_TBL.*, KEY_TBL.RANK
FROM Parts AS FT_TBL 
    INNER JOIN FREETEXTTABLE(Parts,(PartNo, Description),  
    '164') AS KEY_TBL
        ON FT_TBL.PartNo = KEY_TBL.[KEY]
ORDER BY KEY_TBL.RANK DESC;
GO

I tried containstable but that didn't return the rows either

preguntado el 09 de marzo de 12 a las 14:03

1 Respuestas

Full text search won't cover this scenario, where you're essentially looking for the search term as a substring within the text.

Try a traditional wildcard search instead:

SELECT *
FROM Parts AS FT_TBL 
WHERE FT_TBL.PartNo like '%164%'

respondido 09 mar '12, 14:03

A wildcard search can't be ranked though can it? - user1061995

Found a solution run a wildcard search purely on partNo and if that returns 0 rows then run a full text - user1061995

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.