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.
| Author |
Topic |
|
Jsolomon
Starting Member
13 Posts |
Posted - 2010-10-27 : 11:50:48
|
| I have two tables, one called "persons" with name and address data and one called "badwords".I want to search both the FirstName and LastName columns in "persons" table for any of the words from the "badwords" table then mark the records as not valid in the "persons" table. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-10-27 : 12:05:25
|
| [code]UPDATE P SET Valid=0FROM Persons PINNER JOIN BadWords BON P.FirstName LIKE '%' + B.Badword + '%' OR P.LastName LIKE '%' + B.Badword + '%'[/code]This may not be the most efficient way to do it, and you may get false positive matches, i.e. if "ass" is a bad word then "pass", "Massey", etc. will get flagged. |
 |
|
|
|
|
|