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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Company Name Cleaning

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2006-12-05 : 06:19:24
Hi I need to remove company words from the Company_Name field for matching purposes.

i.e
Company_Name MATCH Company_Name (what I want my results to be!)
------------ ------------------
ABC Ltd ABC
ABC Limited ABC
ABC Ltd Corp ABC
123 Public 123
123 Plc Public
123 Public Co

I am trying to use in IN statement to identify where there are keywords:

Query:
SELECT Company_Name from Table1 where Company_Name in (' Ltd', ' Plc') etc. (list of keywords...)

Problem:
This query is not picking out the company with these keywords.
Any suggestions, I would like to identify the rows with these key words and strip them out for matching purposes.

Thanks!!



harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-12-05 : 06:27:22
[code]SELECT Company_Name
from Table1
where Company_Name like '% Ltd%' or Company_name like '% Plc'
[/code] ...etc

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2006-12-05 : 07:15:57
Thanks, i wrote a loop to replace the characters instead.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-12-05 : 10:13:07
quote:
Originally posted by dnf999

Thanks, i wrote a loop to replace the characters instead.


Can you post the code you used?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-12-05 : 10:24:34
SELECT t.Company_Name
from Table1 t
cross join Keywords k
where t.Company_Name like '%' + k.reservedword + '%'



Peter Larsson
Helsingborg, Sweden
Go to Top of Page
   

- Advertisement -