salix/db/changes/10440-fallas/00-country.sql

90 lines
2.1 KiB
SQL

ALTER TABLE `vn`.`country` ADD `a3Code` INT NULL COMMENT 'Código país para a3';
UPDATE `vn`.`country` c
JOIN `vn2008`.`payroll_pais` `p` ON `p`.`pais` = `c`.`country`
SET `c`.`a3Code` = `p`.`codpais`;
UPDATE `vn`.`country`
SET `a3Code` = 710
WHERE `country` = 'Sud-Africa'; -- ÁFRICA DEL SUR
UPDATE `vn`.`country`
SET `a3Code` = 643
WHERE `country` = 'Rusia'; -- FEDERACIÓN DE RUSIA
UPDATE `vn`.`country`
SET `a3Code` = 28
WHERE `country` = 'Antigua'; -- ANTIGUA Y BARBUDA
UPDATE `vn`.`country`
SET `a3Code` = 840
WHERE `country` = 'USA'; -- ESTADOS UNIDOS
UPDATE `vn`.`country`
SET `a3Code` = 404
WHERE `country` = 'Kenya'; -- KENIA
UPDATE `vn`.`country`
SET `a3Code` = 498
WHERE `country` = 'Moldavia'; -- REPÚBLICA DE MOLDAVIA
UPDATE `vn`.`country`
SET `a3Code` = 826
WHERE `country` = 'Gran Bretaña'; -- REINO UNIDO
UPDATE `vn`.`country`
SET `a3Code` = 484
WHERE `country` = 'Mexico'; -- MÉJICO
UPDATE `vn`.`country`
SET `a3Code` = 716
WHERE `country` = 'Zimbawe'; -- ZINBABWE
UPDATE `vn`.`country`
SET `a3Code` = 203
WHERE `country` = 'Chequia'; -- REPÚBLICA CHECA
UPDATE `vn`.`country`
SET `a3Code` = 764
WHERE `country` = 'Thailandia'; -- TAILANDIA
UPDATE `vn`.`country`
SET `a3Code` = 276
WHERE `country` = 'Alemania'; -- REPÚBLICA FEDERAL DE ALEMANIA
UPDATE `vn`.`country`
SET `a3Code` = 112
WHERE `country` = 'Bielorrusia'; -- BELARUS
UPDATE `vn`.`country`
SET `a3Code` = 528
WHERE `country` = 'Holanda'; -- PAÍSES BAJOS
UPDATE `vn`.`country`
SET `a3Code` = 410
WHERE `country` = 'Corea del Sur'; -- COREA (REPÚBLICA)
UPDATE `vn`.`country`
SET `a3Code` = 724
WHERE `country` = 'España exento'; -- ESPAÑA
-- Borrar registro USA de country:
UPDATE `vn`.`supplier` `s`
SET `s`.`countryFk` = 62
WHERE `s`.`countryFk` = 12;
UPDATE `vn`.`bankEntity`
SET `countryFk` = 62
WHERE `countryFk` = 12;
DELETE FROM `vn`.`country`
WHERE `id`= 12;
UPDATE `vn2008`.`payroll_pais`
SET `pais`='COREA NORTE (REPÚBLICA DEM. POPULAR)'
WHERE `codpais`=408;
UPDATE `vn2008`.`payroll_pais`
SET `pais`='COREA SUR (REPÚBLICA) '
WHERE `codpais`=410;
RENAME TABLE `vn2008`.`payroll_pais` TO `vn2008`.`payroll_pais__`;