Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CONTAINS operator within SQL

Author  Topic 

Aequitas
Starting Member

8 Posts

Posted - 2008-10-30 : 15:25:01
Pardon what may be a very simple question:

I am querying a database for records that contain the phrase "North Street RLN 2002-4", within a field called PATH. When I use the CONTAINS operator I recieve records with the values differing from the specified pharse, such as "North Street RLN 2002-1a."

I have done research (unsucessfully) to determin what part of my string is causing this. Should I be using the CONTAINS operator at all, or would LIKE be the correct option? Does SQL treat the "-" as a wildcard?

Thank you in advance for any input.

hanbingl
Aged Yak Warrior

652 Posts

Posted - 2008-10-30 : 15:33:52
LIKE will do the trick and no "-" is not a wildcard
Go to Top of Page

Aequitas
Starting Member

8 Posts

Posted - 2008-10-30 : 16:23:33
Thank you for your quick response. I will continue with the LIKE statement.
Go to Top of Page
   

- Advertisement -