|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Searching on partial match in a text fieldI have a customer who wants to SELECT records based on a partial match in a
text field. For example, in a list of telephone numbers they want to search for all records that contain the digits '777' in any part of the string. How do I formulate such a query? Many thanks. where columnName like '%777%'
Show quote "Andrew Chalk" <ach***@magnacartasoftware.com> wrote in message news:ejQUJw6FGHA.2064@TK2MSFTNGP09.phx.gbl... >I have a customer who wants to SELECT records based on a partial match in a >text field. For example, in a list of telephone numbers they want to search >for all records that contain the digits '777' in any part of the string. >How do I formulate such a query? > > Many thanks. > Wow! That was fast. I don't think I even finished typing the question!
Thanks, and to "SQL" and Barry as well. - Andrew Show quote "Raymond D'Anjou" <rdanjou@canatradeNOSPAM.com> wrote in message news:%23impzx6FGHA.2320@TK2MSFTNGP11.phx.gbl... > where columnName like '%777%' > > "Andrew Chalk" <ach***@magnacartasoftware.com> wrote in message > news:ejQUJw6FGHA.2064@TK2MSFTNGP09.phx.gbl... >>I have a customer who wants to SELECT records based on a partial match in >>a text field. For example, in a list of telephone numbers they want to >>search for all records that contain the digits '777' in any part of the >>string. How do I formulate such a query? >> >> Many thanks. >> > > "Andrew Chalk" <ach***@magnacartasoftware.com> wrote in message No problem.news:ec8pO16FGHA.3936@TK2MSFTNGP12.phx.gbl... > Wow! That was fast. I don't think I even finished typing the question! > > Thanks, and to "SQL" and Barry as well. > > - Andrew This was an easy one. As your customer's requirements progress, you should look into using a
full-text index. It performs much better than the LIKE operator in most cases. ML --- http://milambda.blogspot.com/ This won´t help in that case becasue they do want a wildcard before
and after the searchword. -Jens Suessmeyer. |
|||||||||||||||||||||||