Solved

Using Contains with wildcards in SQL query

Posted on 2014-07-22
2
140 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 24

Accepted Solution

by:
chaau earned 500 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

911 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now