Hi..
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.count ry table and then update the ticket.countryI d to the countries.count ryId.
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:
I know there has to be an easier way to do this. Or is this pretty much the only way, and am I going to have to write a separte update for each country?
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.count ry table and then update the ticket.countryI d to the countries.count ryId.
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:
Code:
update [Ticket].[Ticket] set [Ticket].[Ticket].[CountryId] = '1' where [Ticket].[Ticket].[Country] like 'USA'
Comment