Bruce
Bruce

Reputation: 2213

Using keyword "and" in containstable function

I want to run containstable on "test1 and test2" and would like to run the test on the keyword "and" as well.

However the following gives me an error:

containstable(table_name, column_name, 'test1 AND "and" test2')

The syntax from MSDN does not indicate whether such keywords are allowed or not and if they are how they can be used.

Thanks, Bruce

Upvotes: 2

Views: 845

Answers (2)

Bruce
Bruce

Reputation: 2213

I found it, the answer is:

containstable(table_name, column_name, 'test1 AND "and test2"') 

Note that the double quotes go around "and test2" and not just "and"

Upvotes: 0

Jim H.
Jim H.

Reputation: 5579

Look at

http://msdn.microsoft.com/en-us/library/ms189760.aspx

and one of the examples works similarly to your test.

containstable(table, column, '("sweet and savory" NEAR sauces) OR
    ("sweet and savory" NEAR candies)')

Modify the constraints to match your data.

Edit: I should also specify that 'test1 AND "and" test2' is not a boolean condition at any rate. Try:

'(test1 AND "and") OR (test2 AND "and")'

or something similar that will evaluate to a boolean condition.

Upvotes: 1

Related Questions