BEGIN TRANSACTION;

BEGIN TRY

UPDATE clientes SET CliCPoPro = 'Araba' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '01';
UPDATE clientes SET CliCPoPro = 'Albacete' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '02';
UPDATE clientes SET CliCPoPro = 'Alicante' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '03';
UPDATE clientes SET CliCPoPro = 'Almería' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '04';
UPDATE clientes SET CliCPoPro = 'Ávila' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '05';
UPDATE clientes SET CliCPoPro = 'Badajoz' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '06';
UPDATE clientes SET CliCPoPro = 'Baleares' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '07';
UPDATE clientes SET CliCPoPro = 'Barcelona' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '08';
UPDATE clientes SET CliCPoPro = 'Burgos' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '09';
UPDATE clientes SET CliCPoPro = 'Cáceres' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '10';
UPDATE clientes SET CliCPoPro = 'Cádiz' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '11';
UPDATE clientes SET CliCPoPro = 'Castellón' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '12';
UPDATE clientes SET CliCPoPro = 'Ciudad Real' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '13';
UPDATE clientes SET CliCPoPro = 'Córdoba' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '14';
UPDATE clientes SET CliCPoPro = 'Coruña' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '15';
UPDATE clientes SET CliCPoPro = 'Cuenca' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '16';
UPDATE clientes SET CliCPoPro = 'Gerona' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '17';
UPDATE clientes SET CliCPoPro = 'Granada' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '18';
UPDATE clientes SET CliCPoPro = 'Guadalajara' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '19';
UPDATE clientes SET CliCPoPro = 'Gipuzkoa' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '20';
UPDATE clientes SET CliCPoPro = 'Huelva' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '21';
UPDATE clientes SET CliCPoPro = 'Huesca' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '22';
UPDATE clientes SET CliCPoPro = 'Jaén' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '23';
UPDATE clientes SET CliCPoPro = 'León' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '24';
UPDATE clientes SET CliCPoPro = 'Lérida' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '25';
UPDATE clientes SET CliCPoPro = 'La Rioja' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '26';
UPDATE clientes SET CliCPoPro = 'Lugo' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '27';
UPDATE clientes SET CliCPoPro = 'Madrid' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '28';
UPDATE clientes SET CliCPoPro = 'Málaga' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '29';
UPDATE clientes SET CliCPoPro = 'Murcia' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '30';
UPDATE clientes SET CliCPoPro = 'Navarra' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '31';
UPDATE clientes SET CliCPoPro = 'Orense' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '32';
UPDATE clientes SET CliCPoPro = 'Asturias' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '33';
UPDATE clientes SET CliCPoPro = 'Palencia' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '34';
UPDATE clientes SET CliCPoPro = 'Las Palmas' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '35';
UPDATE clientes SET CliCPoPro = 'Pontevedra' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '36';
UPDATE clientes SET CliCPoPro = 'Salamanca' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '37';
UPDATE clientes SET CliCPoPro = 'Santa Cruz de Tenerife' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '38';
UPDATE clientes SET CliCPoPro = 'Cantabria' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '39';
UPDATE clientes SET CliCPoPro = 'Segovia' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '40';
UPDATE clientes SET CliCPoPro = 'Sevilla' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '41';
UPDATE clientes SET CliCPoPro = 'Soria' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '42';
UPDATE clientes SET CliCPoPro = 'Tarragona' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '43';
UPDATE clientes SET CliCPoPro = 'Teruel' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '44';
UPDATE clientes SET CliCPoPro = 'Toledo' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '45';
UPDATE clientes SET CliCPoPro = 'Valencia' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '46';
UPDATE clientes SET CliCPoPro = 'Valladolid' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '47';
UPDATE clientes SET CliCPoPro = 'Bizkaia' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '48';
UPDATE clientes SET CliCPoPro = 'Zamora' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '49';
UPDATE clientes SET CliCPoPro = 'Zaragoza' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '50';
UPDATE clientes SET CliCPoPro = 'Ceuta' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '51';
UPDATE clientes SET CliCPoPro = 'Melilla' WHERE CliCPoPro = '' AND LEFT(CliCPoId, 2) = '52';

UPDATE CliDir SET CliDCPoPro = 'Araba' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '01';
UPDATE CliDir SET CliDCPoPro = 'Albacete' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '02';
UPDATE CliDir SET CliDCPoPro = 'Alicante' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '03';
UPDATE CliDir SET CliDCPoPro = 'Almería' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '04';
UPDATE CliDir SET CliDCPoPro = 'Ávila' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '05';
UPDATE CliDir SET CliDCPoPro = 'Badajoz' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '06';
UPDATE CliDir SET CliDCPoPro = 'Baleares' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '07';
UPDATE CliDir SET CliDCPoPro = 'Barcelona' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '08';
UPDATE CliDir SET CliDCPoPro = 'Burgos' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '09';
UPDATE CliDir SET CliDCPoPro = 'Cáceres' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '10';
UPDATE CliDir SET CliDCPoPro = 'Cádiz' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '11';
UPDATE CliDir SET CliDCPoPro = 'Castellón' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '12';
UPDATE CliDir SET CliDCPoPro = 'Ciudad Real' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '13';
UPDATE CliDir SET CliDCPoPro = 'Córdoba' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '14';
UPDATE CliDir SET CliDCPoPro = 'Coruña' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '15';
UPDATE CliDir SET CliDCPoPro = 'Cuenca' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '16';
UPDATE CliDir SET CliDCPoPro = 'Gerona' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '17';
UPDATE CliDir SET CliDCPoPro = 'Granada' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '18';
UPDATE CliDir SET CliDCPoPro = 'Guadalajara' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '19';
UPDATE CliDir SET CliDCPoPro = 'Gipuzkoa' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '20';
UPDATE CliDir SET CliDCPoPro = 'Huelva' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '21';
UPDATE CliDir SET CliDCPoPro = 'Huesca' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '22';
UPDATE CliDir SET CliDCPoPro = 'Jaén' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '23';
UPDATE CliDir SET CliDCPoPro = 'León' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '24';
UPDATE CliDir SET CliDCPoPro = 'Lérida' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '25';
UPDATE CliDir SET CliDCPoPro = 'La Rioja' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '26';
UPDATE CliDir SET CliDCPoPro = 'Lugo' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '27';
UPDATE CliDir SET CliDCPoPro = 'Madrid' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '28';
UPDATE CliDir SET CliDCPoPro = 'Málaga' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '29';
UPDATE CliDir SET CliDCPoPro = 'Murcia' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '30';
UPDATE CliDir SET CliDCPoPro = 'Navarra' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '31';
UPDATE CliDir SET CliDCPoPro = 'Orense' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '32';
UPDATE CliDir SET CliDCPoPro = 'Asturias' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '33';
UPDATE CliDir SET CliDCPoPro = 'Palencia' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '34';
UPDATE CliDir SET CliDCPoPro = 'Las Palmas' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '35';
UPDATE CliDir SET CliDCPoPro = 'Pontevedra' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '36';
UPDATE CliDir SET CliDCPoPro = 'Salamanca' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '37';
UPDATE CliDir SET CliDCPoPro = 'Santa Cruz de Tenerife' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '38';
UPDATE CliDir SET CliDCPoPro = 'Cantabria' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '39';
UPDATE CliDir SET CliDCPoPro = 'Segovia' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '40';
UPDATE CliDir SET CliDCPoPro = 'Sevilla' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '41';
UPDATE CliDir SET CliDCPoPro = 'Soria' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '42';
UPDATE CliDir SET CliDCPoPro = 'Tarragona' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '43';
UPDATE CliDir SET CliDCPoPro = 'Teruel' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '44';
UPDATE CliDir SET CliDCPoPro = 'Toledo' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '45';
UPDATE CliDir SET CliDCPoPro = 'Valencia' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '46';
UPDATE CliDir SET CliDCPoPro = 'Valladolid' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '47';
UPDATE CliDir SET CliDCPoPro = 'Bizkaia' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '48';
UPDATE CliDir SET CliDCPoPro = 'Zamora' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '49';
UPDATE CliDir SET CliDCPoPro = 'Zaragoza' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '50';
UPDATE CliDir SET CliDCPoPro = 'Ceuta' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '51';
UPDATE CliDir SET CliDCPoPro = 'Melilla' WHERE CliDCPoPro = '' AND LEFT(CliDCPoId, 2) = '52';

    COMMIT TRANSACTION;
END TRY
BEGIN CATCH
    ROLLBACK TRANSACTION;
    PRINT 'Error: ' + ERROR_MESSAGE();
END CATCH;