Skip to content Skip to sidebar Skip to footer

CONTAINSTABLE And CONTAINS, Which String To Pass To Match All Records?

We have a Single Statement FUNCTION in SQL Server 2005 which uses CONTAINSTABLE(). All works fine when we pass a non empty search string. Is there a wildcard string we can pass to

Solution 1:

You have to use logic within the stored procedure to run a SQL statement without the CONTAINSTABLE predicate if there isn't a full text phrase to search by.


Solution 2:

I don't think there is, you'd have to do something like (psuedocode)

IF @searchterm='*' 
    SELECT * FROM YOURTTABLE
ELSE
    SELECT * FROM YOURTABLE INNER JOIN CONTAINSTABLE etc
END IF

Post a Comment for "CONTAINSTABLE And CONTAINS, Which String To Pass To Match All Records?"