Full text Stored procedure

  • I'm using this procedure to seach in my database:

    ----------------------

    ALTER PROCEDURE [dbo].[Search]

    @search nvarchar (250)

    as

    SELECT *

    FROM text

    WHERE CONTAINS

    (*, @search);

    ------------------------

    When I try to search for only one word I receive results, but when I try to search for 2 or more words, I get error:

    ----------------------

    Msg 7630, Level 15, State 3, Procedure Search, Line 4

    Syntax error near 'word' in the full-text search condition 'Word word'.

    ----------------------

    If I put + between the word I get results. How to modify stored procedure to get results for more then one word?

  • Have you tried this format:

    SELECT Name --Column being searched

    FROM Production.Product -- Table being searched

    WHERE CONTAINS(Name, ' "Mountain" OR "Road" ') -- 2 different words

    Hope this helps if not you may want to read:

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/tsqlref9/html/996c72fc-b1ab-4c96-bd12-946be9c18f84.htm

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply