Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


PatIndex Problem

Posted on 2003-02-25
Medium Priority
Last Modified: 2008-03-06
I've been recently looking for a way to see if a keyword is used within a given text in the database and have been using PatIndex to check if that word exists... problem is, when I search for PatIndex('%car%', @SearchText), if the searchtext has the word cartridge, it also picks it up.  I have tried using two spaces, one at the begining and one at the end... but that causes car's to be rejected...

Any help is much appreciated.
Question by:yleviel
LVL 18

Accepted Solution

nigelrivett earned 150 total points
ID: 8022055
I think you want to look at full text search.


where patindex('[ ',;:,]car[ ',;:]', ' ' + fld + ' ') <>0

or maybe

where patindex('[^A-Z^a-z]car[^A-Z^a-z]', ' ' + fld + ' ') <>0

Author Comment

ID: 8025717
In the end I used:


Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
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
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

578 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