freetext problem

  • Hi

    i wrote an storeprocedure alter PROCEDURE [dbo].[SearchEmployee]

    @VarEmp_Id int,

    @VarEmp_Name nvarchar(50),

    @VarEmp_Surename nvarchar(50),

    @VarEmp_Shomareshenasname nvarchar(50)

    AS

    BEGIN

    select Emp_Id,Emp_Name,Emp_Surename,Emp_Shomareshenasname

    from Employee

    where (@VarEmp_Id='')or(Emp_Id=@VarEmp_Id) or

    ((@VarEmp_Name='') or freetext( Emp_Name,@VarEmp_Name)) or

    ((@VarEmp_Surename='' )or freetext (Emp_Surename,@VarEmp_Surename))or

    (@VarEmp_Shomareshenasname='')or(Emp_Shomareshenasname=@VarEmp_Shomareshenasname)

    END

    GO

    but forexample when i put @VarEmp_Name= f

    and the other variables are null

    this error is occured:

    Msg 7645, Level 15, State 1, Procedure SearchEmployee, Line 16

    Null or empty full-text predicate.

    Informational: The full-text search condition contained noise word(s).

    would you please help me?

  • It is well known issue with SQL Server full-text predicates.

    You can use dynamic sql with sp_executesql or -

    I have once used the following and it did work:

    IF ISNULL(@Param,'') = '' SET @Param = '""' -- two double quotes

    and then in the WHERE clause:

    WHERE (@Param = '""' OR ....

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

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

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