Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using Contains with wildcards in SQL query

Posted on 2014-07-22
2
Medium Priority
?
159 Views
Last Modified: 2014-07-22
I know how to use contains to produce results if for example I type CONTAINS(<fieldname>,'Administration AND Reception'), but how can I get results if I want to match partial words -

I have tried CONTAINS('Admin% AND Recept%') which doesn't work.
 
I Have also tried <fieldname> LIKE 'Admin%' AND<fieldname> LIKE 'Recept%', but that doesn't work either.

I need to find documents which contain both words.
0
Comment
Question by:jdthedj
2 Comments
 
LVL 25

Accepted Solution

by:
chaau earned 2000 total points
ID: 40213259
You can either use:
 CONTAINS(<fieldname>, '"Admin*" AND "Recept*"') 

Open in new window

or
<fieldname> LIKE '% Admin%' AND<fieldname> LIKE '% Recept%'

Open in new window

The latter will not be using FULL TEXT SEARCH and would be slower in my opinion
0
 
LVL 3

Author Closing Comment

by:jdthedj
ID: 40213269
Thanks chaau - I didn't realise that I needed * and double quotes in CONTAINS instead of %
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question