• Create a replacement values table, and use it to do the data replacement.

    CREATE TABLE dbo.data_replacements (

    column_name varchar(30) NOT NULL,

    current_value varchar(100) NULL,

    replacement_value varchar(100) NULL,

    CONSTRAINT data_replacements__CL UNIQUE CLUSTERED ( column_name, current_value )

    )

    INSERT INTO dbo.data_replacements ( column_name, current_value, replacement_value )

    SELECT 'city', 'JRK_Ikosium', 'Icosium' UNION ALL

    SELECT 'city', 'JRK_Géryville', 'El_Bayadh' UNION ALL

    SELECT 'city', 'JRK_Cirta', 'Constantine' UNION ALL

    SELECT 'city', 'JRK_Rusicade', 'Philippeville' UNION ALL

    SELECT 'city', 'JRK_Saldae', 'Bougie'

    select t.id, t.city, COALESCE(city_replacement.replacement_value, t.city) AS New_city_name

    from towns t

    outer apply (

    select top (1) dr.replacement_value

    from dbo.data_replacements dr

    where

    dr.column_name = 'city' and

    dr.current_value = t.city

    ) as city_replacement

    SQL DBA,SQL Server MVP(07, 08, 09) A socialist is someone who will give you the shirt off *someone else's* back.