I have 2 tables: country and ticket
country table contains countryId and countries
ticket table contains many fields, and a country field
the country table is new and consists of all countries to be used in a drop down on the ui, that is joined with the ticket table to display the correct country based on the id.
that being said.. the current ticket table also contains a country field which will be eliminated in the future. what I want to do is update the ticket table by finding the closest match to ticket.country in the countries.country table and then update the ticket.countryId to the countries.countryId.
The only problem is, users have entered in varying names for countries. Example: USA, U.S.A, America instead of United States of America.
This is what i have been doing country by country:
Expand|Select|Wrap|Line Numbers
- update [Ticket].[Ticket]
- set [Ticket].[Ticket].[CountryId] = '1'
- where [Ticket].[Ticket].[Country] like 'USA'