--Mudança do codigo da Empresa declare @antes varchar(10) = 'implanta' declare @depois varchar(10) = 'sgm' update AcumuladorINSSIRRF set filtroempresa=@depois where filtroempresa=@antes update AcumuladorINSSRetidoPFisica set filtroempresa=@depois where filtroempresa=@antes update AcumuladorServicoPerido set filtroempresa=@depois where filtroempresa=@antes update AlarmeRevisaoVeiculo set filtroempresa=@depois where filtroempresa=@antes update AnaliseEscoria set filtroempresa=@depois where filtroempresa=@antes update AnaliseGasAltoForno set filtroempresa=@depois where filtroempresa=@antes update AnaliseQuimica set filtroempresa=@depois where filtroempresa=@antes update AvaliacaoFornecedor set filtroempresa=@depois where filtroempresa=@antes update BoletimPagamento set filtroempresa=@depois where filtroempresa=@antes update BorderoRemessa set filtroempresa=@depois where filtroempresa=@antes update CDComplementar set filtroempresa=@depois where filtroempresa=@antes update Compromisso set filtroempresa=@depois where filtroempresa=@antes update ConfiguracaoApuracao set filtroempresa=@depois where filtroempresa=@antes update ConfiguracaoAutorizacaoCompras set filtroempresa=@depois where filtroempresa=@antes update ConfiguracaoPatrimonio set filtroempresa=@depois where filtroempresa=@antes update ContaHistoricoEmpresa set filtroempresa=@depois where filtroempresa=@antes update ContaPadraoARCP set filtroempresa=@depois where filtroempresa=@antes update ContaPadraoARCR set filtroempresa=@depois where filtroempresa=@antes update ContratoCarvao set filtroempresa=@depois where filtroempresa=@antes update CreditoCiap set filtroempresa=@depois where filtroempresa=@antes update CreditoCredor set filtroempresa=@depois where filtroempresa=@antes update CustoAdicionalCarvao set filtroempresa=@depois where filtroempresa=@antes update DadoComercialProduto set filtroempresa=@depois where filtroempresa=@antes update DataLimiteLancamento set filtroempresa=@depois where filtroempresa=@antes update DiferencaInventario set filtroempresa=@depois where filtroempresa=@antes update Documento set filtroempresa=@depois where filtroempresa=@antes update DocumentoBancos set filtroempresa=@depois where filtroempresa=@antes update DocumentoEstoque set filtroempresa=@depois where filtroempresa=@antes update DocumentoEstoqueProducao set filtroempresa=@depois where filtroempresa=@antes update DocumentoQualidade set filtroempresa=@depois where filtroempresa=@antes update DocumentoQualidadeClausula set filtroempresa=@depois where filtroempresa=@antes update Estoque set filtroempresa=@depois where filtroempresa=@antes update FaixaIR set filtroempresa=@depois where filtroempresa=@antes update Fatura set filtroempresa=@depois where filtroempresa=@antes update Fornecimento set filtroempresa=@depois where filtroempresa=@antes update GuiaAmbiental set filtroempresa=@depois where filtroempresa=@antes update HistoricoCalculo set filtroempresa=@depois where filtroempresa=@antes update ISOClausula set filtroempresa=@depois where filtroempresa=@antes update Imagem set filtroempresa=@depois where filtroempresa=@antes update InterfaceSistemas set filtroempresa=@depois where filtroempresa=@antes update ItemBoletimPagamento set filtroempresa=@depois where filtroempresa=@antes update ItemTabelaDensidadeUmidadeCarvao set filtroempresa=@depois where filtroempresa=@antes update LancamentoComplementar set filtroempresa=@depois where filtroempresa=@antes update LancamentoDeApuracao set filtroempresa=@depois where filtroempresa=@antes update ListaMestraDocumentos set filtroempresa=@depois where filtroempresa=@antes update LocalizacaoQualidade set filtroempresa=@depois where filtroempresa=@antes update LocalizacaoSuprimento set filtroempresa=@depois where filtroempresa=@antes update LoteGuia set filtroempresa=@depois where filtroempresa=@antes update ModeloContratoAdiantamento set filtroempresa=@depois where filtroempresa=@antes update MovimentoAdicionalMaterial set filtroempresa=@depois where filtroempresa=@antes update MovimentoAlmoxarifado set filtroempresa=@depois where filtroempresa=@antes update NotaFiscalFornecedor set filtroempresa=@depois where filtroempresa=@antes update OrdemCompra set filtroempresa=@depois where filtroempresa=@antes update OrdemServico set filtroempresa=@depois where filtroempresa=@antes update Pagamento set filtroempresa=@depois where filtroempresa=@antes update PagamentoCustoCredor set filtroempresa=@depois where filtroempresa=@antes update ParametroInterno set filtroempresa=@depois where filtroempresa=@antes update ParametroQualidadeClasseCarvao set filtroempresa=@depois where filtroempresa=@antes update ParametroRPA set filtroempresa=@depois where filtroempresa=@antes update ParametrosOperacionaisEstoque set filtroempresa=@depois where filtroempresa=@antes update PedidoCompra set filtroempresa=@depois where filtroempresa=@antes update PreLancBCApuracao set filtroempresa=@depois where filtroempresa=@antes update PreLancCPApuracao set filtroempresa=@depois where filtroempresa=@antes update PreLancCRApuracao set filtroempresa=@depois where filtroempresa=@antes update PreLancMTApuracao set filtroempresa=@depois where filtroempresa=@antes update PreLancNFEApuracao set filtroempresa=@depois where filtroempresa=@antes update PreLancNFSApuracao set filtroempresa=@depois where filtroempresa=@antes update ProjetoDesmate set filtroempresa=@depois where filtroempresa=@antes update ProjetoFlorestal set filtroempresa=@depois where filtroempresa=@antes update PropostaModificacao set filtroempresa=@depois where filtroempresa=@antes update Recebimento set filtroempresa=@depois where filtroempresa=@antes update RelacaoTicketDocumento set filtroempresa=@depois where filtroempresa=@antes update RelacaoTipoDocEstoque set filtroempresa=@depois where filtroempresa=@antes update Responsavel set filtroempresa=@depois where filtroempresa=@antes update ResponsavelArea set filtroempresa=@depois where filtroempresa=@antes update ResumoCIAP set filtroempresa=@depois where filtroempresa=@antes update RpaLancada set filtroempresa=@depois where filtroempresa=@antes update SaldoCalculadoNoPeriodo set filtroempresa=@depois where filtroempresa=@antes update SetorExecutante set filtroempresa=@depois where filtroempresa=@antes update TabelaImposto set filtroempresa=@depois where filtroempresa=@antes update TabelaImpostoRenda set filtroempresa=@depois where filtroempresa=@antes update TalaoCheque set filtroempresa=@depois where filtroempresa=@antes update TalhaoFlorestal set filtroempresa=@depois where filtroempresa=@antes update TipoCarregamentoFrete set filtroempresa=@depois where filtroempresa=@antes update TipoPrestadorServico set filtroempresa=@depois where filtroempresa=@antes update TransporteLote set filtroempresa=@depois where filtroempresa=@antes update UtilitariosContasReceber set filtroempresa=@depois where filtroempresa=@antes update ValorImposto set filtroempresa=@depois where filtroempresa=@antes update ContaAgenteTipoRecebimento set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaCliente set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaContabilCentroResultado set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaContabilContaPatrimonio set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaContabilGrupoServicos set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaContabilTipoOperacao set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaCredor set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaGrupoEmpresa set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaGrupoMaterialRM set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaImposto set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaImpostoRetidoFonteEmpresa set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaParametroFaturamento set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaTipoCDEmpresa set filtroempresanormal=@depois where filtroempresanormal=@antes update ContaTipoDocumentoBancario set filtroempresanormal=@depois where filtroempresanormal=@antes update EmpresaHistoricoCP set filtroempresanormal=@depois where filtroempresanormal=@antes update HistoricoContaPatrimonial set filtroempresanormal=@depois where filtroempresanormal=@antes update HistoricoContaPatrimonial set filtroempresanormal=@depois where filtroempresanormal=@antes update Empresa set Codigo=@depois where Codigo=@antes update EmpresaContabil set Codigo=@depois where Codigo=@antes update PlanoContas set Descricao=@depois where filtroempresanormal=@antes update ContaParametroFaturamento set FiltroEmpresaContabil=@depois where filtroempresanormal=@antes update Conta set FiltroPlanoContas=@depois where filtroempresanormal=@antes --Ativacao da Empresa insert AutorizacaoUsoSistema (CodigoEmpresaCliente, ChavePrivadaEmpresaCliente, ChavePublicaEmpresaCliente, ChavePublicaMetalsoft, UltimosDadosObtidos) values ('sgm', 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIQvPNdZTnnGIITvaZOa1SIe8pm5ZLAWpAfbgX2Rc3DzODR4CMGiqZbDeCuC9ZlD40ekG2NDOCqJgBI95B3+fAeSsTBG2vIIsy5hYIsCZt83nSbzfdjGJRvAx9X7YO0FW2zv5wg/2BuNFjK87aqALIs7TR01Ha0RM8uAQMo41mLXAgMBAAECgYAbBeU0SUen0X9YbfFxgZfM7/K8xo/1B8vk51UjrJajIrX81AVGQNDWx4NLsewvtxdB0CThOB7FY3LRR+HY1+vW/UZQ6NRD8vJI5RuEqBhDe/cdSU7ElPre769e0FUCUpzerb9ablvX0a1wBCdRPgxS0ms90Naz5J18tlgmROrR8QJBALtKNc8+WBNYT2fp0dUfavxyKpRf4tElUUtqeGulS1fJbEsm4xV/pv/91TnByGUe88jnHrvTBE7QzKoKRakZu+UCQQC0rawHZBryrOu/8VvTazsiUSNrOuQxKNXCZkxVE6pl7up3nlJg/LyYTmgbDJjSdBraV1CsB+JcogY3JadHORALAkBFREbuZNJSJUEI33MZbUs2HksdIPFUBIcyaygqN7HLv9TrXnBxzQpIdupbOA4TSAVFciTttjdLpvFqme31gmz5AkEAjYqkguHETqpywVqGUjjmCXtA4QcwruZLl1BmqhuO2O3y1qS76mj0IekCm3Yh3nTAeJ4Af9RpW6I+dkNUKXKlgwJBAJcp50d3PWOo98xF1vMaqVHG5CNGyKTmYj6EFY8+k1XEno5avhDRbLfWJrA86BVDb1dSKDZ46mGUObsdOxGSi3I=', 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCELzzXWU55xiCE72mTmtUiHvKZuWSwFqQH24F9kXNw8zg0eAjBoqmWw3grgvWZQ+NHpBtjQzgqiYASPeQd/nwHkrEwRtryCLMuYWCLAmbfN50m833YxiUbwMfV+2DtBVts7+cIP9gbjRYyvO2qgCyLO00dNR2tETPLgEDKONZi1wIDAQAB', 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC/HdZu1BejG1O4ipvcoU+Z4IsKi7vHZFFanCdzDrkeml/Pj/VNgQDsAdjIFSM6dq6HcBZc5v5qRZ9gwREyWB65FbXYHXtdm54++5svKZAU6HoNRg/ZIGexA+oKWY7V0qRXVItCtRJi+N9ErtGdfpl3n/ANXNKsnE1l2zN3PlcBzQIDAQAB', '') insert AutorizacaoUsoSistema (CodigoEmpresaCliente, ChavePrivadaEmpresaCliente, ChavePublicaEmpresaCliente,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