--  Corrections to the conservation_resources soilmu_a table.  
--  Revision Date:  04-11-2016

BEGIN
USE conservation_resources;
	BEGIN TRANSACTION FixIowa;
	  DELETE FROM ssurgo.soilmu_a WHERE areasymbol IN ('IA001','IA005','IA007','IA009','IA011','IA019','IA021','IA023','IA025','IA027','IA033','IA035','IA037','IA039','IA041','IA043','IA045','IA047','IA049','IA051','IA053','IA055','IA057','IA061','IA063','IA065','IA067','IA069','IA071','IA073','IA075','IA077','IA079','IA081','IA083','IA085','IA087','IA089','IA093','IA097','IA099','IA101','IA103','IA105','IA109','IA111','IA113','IA115','IA117','IA119','IA121','IA123','IA127','IA129','IA131','IA135','IA137','IA139','IA141','IA143','IA145','IA147','IA149','IA151','IA155','IA193');
	  INSERT INTO ssurgo.soilmu_a (areasymbol, mukey, musym, spatialver, the_geom ) (SELECT areasymbol, mukey, musym, spatialver, geometry::STGeomFromText(the_geom.STAsText(), 0) FROM ssurgo.soilmu_a_tx );
	COMMIT TRANSACTION FixIowa;

	BEGIN TRANSACTION FixTexas;
	  DELETE FROM ssurgo.soilmu_a WHERE areasymbol IN ('TX001','TX003','TX005','TX009','TX011','TX017','TX019','TX021','TX023','TX027','TX029','TX033','TX037','TX045','TX051','TX055','TX057','TX059','TX065','TX069','TX071','TX073','TX075','TX077','TX079','TX081','TX083','TX085','TX087','TX089','TX093','TX095','TX097','TX099','TX101','TX105','TX107','TX111','TX115','TX117','TX125','TX129','TX131','TX145','TX147','TX149','TX153','TX155','TX161','TX163','TX165','TX167','TX169','TX171','TX175','TX179','TX185','TX189','TX191','TX193','TX195','TX197','TX199','TX201','TX203','TX205','TX207','TX211','TX213','TX215','TX217','TX219','TX225','TX227','TX231','TX233','TX235','TX237','TX239','TX243','TX249','TX255','TX259','TX263','TX265','TX267','TX269','TX275','TX279','TX281','TX283','TX285','TX287','TX289','TX291','TX295','TX303','TX305','TX309','TX311','TX317','TX319','TX321','TX323','TX329','TX335','TX337','TX339','TX341','TX345','TX347','TX349','TX353','TX357','TX359','TX363','TX365','TX367','TX369','TX371','TX375','TX377','TX381','TX387','TX393','TX395','TX399','TX401','TX411','TX413','TX415','TX417','TX419','TX421','TX423','TX427','TX429','TX431','TX433','TX435','TX437','TX439','TX441','TX443','TX445','TX447','TX451','TX453','TX455','TX457','TX463','TX465','TX467','TX469','TX471','TX475','TX477','TX479','TX481','TX483','TX485','TX487','TX489','TX491','TX493','TX497','TX499','TX501','TX503','TX505','TX600','TX601','TX602','TX603','TX604','TX605','TX606','TX607','TX608','TX609','TX610','TX611','TX612','TX613','TX614','TX615','TX616','TX617','TX618','TX619','TX620','TX621','TX622','TX623','TX624','TX625','TX626','TX627');
	  INSERT INTO ssurgo.soilmu_a (areasymbol, mukey, musym, spatialver, the_geom ) (SELECT areasymbol, mukey, musym, spatialver, geometry::STGeomFromText(the_geom.STAsText(), 0) FROM ssurgo.soilmu_a_tx );
	  DELETE FROM ssurgo.soilmu_a WHERE areasymbol='TX602';
	  INSERT INTO ssurgo.soilmu_a (areasymbol, mukey, musym, spatialver, the_geom ) (SELECT areasymbol, mukey, musym, spatialver, geometry::STGeomFromText(the_geom.STAsText(), 0) FROM ssurgo.soilmu_a_tx_602 );
	COMMIT TRANSACTION FixTexas;

	BEGIN TRANSACTION FixNorthCarolina;
	  DELETE FROM ssurgo.soilmu_a WHERE areasymbol IN ('NC001','NC003','NC005','NC007','NC009','NC011','NC017','NC019','NC021','NC023','NC025','NC027','NC033','NC035','NC037','NC039','NC041','NC043','NC045','NC047','NC051','NC053','NC057','NC059','NC061','NC063','NC065','NC067','NC069','NC071','NC075','NC081','NC089','NC091','NC093','NC097','NC099','NC103','NC105','NC107','NC109','NC111','NC113','NC115','NC119','NC121','NC123','NC125','NC129','NC133','NC135','NC139','NC143','NC145','NC147','NC149','NC151','NC153','NC155','NC157','NC159','NC161','NC163','NC165','NC167','NC169','NC171','NC175','NC179','NC183','NC185','NC189','NC191','NC193','NC197','NC199','NC605','NC606');
	  INSERT INTO ssurgo.soilmu_a (areasymbol, mukey, musym, spatialver, the_geom ) (SELECT areasymbol, mukey, musym, spatialver, geometry::STGeomFromText(the_geom.STAsText(), 0) FROM ssurgo.soilmu_a_nc );
	COMMIT TRANSACTION FixNorthCarolina;	
END;
