INSERT INTO versao_sistema (Dominio, Seq , Versao, DH_Atualizacao) SELECT 0, (SELECT (IFNULL(MAX(Seq), 0) + 1) FROM versao_sistema WHERE Dominio = 0 LIMIT 1),  "16.04.00", now() FROM dominio LIMIT 1;

INSERT INTO versao_sistema (Dominio, Seq , Versao, DH_Atualizacao) SELECT Dominio AS T_Dominio, (SELECT (IFNULL(MAX(Seq), 0)+1) FROM versao_sistema WHERE Dominio = T_Dominio LIMIT 1), "16.04.00",  now() FROM dominio WHERE Dominio > 0;


ALTER TABLE nota_fiscal
	CHANGE COLUMN NFe_Situacao NFe_Situacao CHAR(4) NOT NULL DEFAULT '' COLLATE 'latin1_swedish_ci' AFTER NFe_Versao_SF;

ALTER TABLE nota_frete
	CHANGE COLUMN CTe_Situacao CTe_Situacao CHAR(4) NOT NULL DEFAULT '' COLLATE 'latin1_swedish_ci' AFTER CTe_Versao_SF;

ALTER TABLE manifesto_carga
	CHANGE COLUMN MDFe_Situacao MDFe_Situacao VARCHAR(4) NOT NULL DEFAULT '' COLLATE 'latin1_swedish_ci' AFTER MDFe_Versao_Proc;

