Gazing into my crystal ball I observed "Toni" <> writing
in news:#:
> I need to match a string in a database, but ignore any trailing
> punctuation such as a period, exclamation point, or question mark.
>
> for example,
>
> SELECT * FROM tbl_stuff WHERE phrase = term
>
> So, if row 5 of the database contains phrase="This is great and
> exciting!" and term = "This is great and exciting" (no trailing
> exclamation point), it will match row 5.
>
> But if term = "This is great", it will not match.
>
> Can anyone please help?
>
> Thanks!!!
>
>
>
Two things:
1. It's not a good idea to SELECT * - you should always explicitly state
the columns you need in a query. You can Google for the reasons why.
2. What you need is LIKE:
SELECT fields FROM TABLE WHERE field LIKE 'This is great and exciting%'
The percent sign will catch anything where "This is a great and
exciting" is at the front of the phrase.
--
Adrienne Boswell at Home
Arbpen Web Site Design Services
http://www.cavalcade-of-coding.info
Please respond to the group so others can share