We help IT Professionals succeed at work.

MS SQL CONTAINSTABLE() - Must Contain Both Words

skij
skij asked
on
138 Views
Last Modified: 2018-04-06
This does not return any results even though both "red" and "yellow" are found because the exact phrase "red and yellow" is not found:

INNER JOIN CONTAINSTABLE(ipm_asset, *, 'FORMSOF(THESAURUS, "red AND yellow")')

Open in new window


How can I use CONTAINSTABLE so that both the words "red" and "yellow" are found in any order or position?
Comment
Watch Question

Scott PletcherSenior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
@Scott Pletcher: your idea returns a syntax error.

I need a solution that actually works.
Scott PletcherSenior DBA
CERTIFIED EXPERT
Most Valuable Expert 2018
Distinguished Expert 2019

Commented:
Did you complete the JOIN syntax??  You left the JOIN "hanging" -- no table alias for the CONTAINSTABLE and no ON clause for the JOIN -- on your initial post so I didn't know how to complete it, but it cause a syntax error if left hanging.
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Author

Commented:
Each term needs its own FORMSOF() statement.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions