| ♥ 0 | ExecuteNonQuery failed for Database ‘PRICAP2002’. An exception occurred while executing a Transact-SQL statement or batch. Cannot insert the value NULL into column ‘TotalMBase’, table ‘PRICAP2002.dbo.Pagamentos’; column does not allow nulls. UPDATE fails. The statement has been terminated. Marked as spam |
| Private answer Para resolver o erro "Cannot insert the value NULL into column 'TotalMBase'" na tabela 'Pagamentos', deverá executar a seguinte instrução SQL para definir valores padrão para as colunas que não permitem valores nulos: Instrução SQL: ALTER TABLE [dbo].[Pagamentos] ADD [TotalMBase] [float] NOT NULL CONSTRAINT [Pagamentos_TotalMBase_DF] DEFAULT ((0)), [ValorLiquidoMBase] [float] NOT NULL CONSTRAINT [Pagamentos_ValorLiquidoMBase_DF] DEFAULT ((0)) Notas importantes:
Se o problema persistir ou existirem registos inconsistentes na tabela 'Pagamentos', pode ser necessário identificar e remover esses registos. Utilize o seguinte comando SQL para verificar e eliminar registos inconsistentes: Comando SQL para identificar registos inconsistentes: SELECT p.NumProc, * FROM Pagamentos p LEFT JOIN MovimentosFuncionarios mf ON p.NumProc = mf.NumProc AND mf.IdLinha =1 WHERE mf.NumProc IS NULL Comando SQL para eliminar registos inconsistentes: DELETE p FROM Pagamentos p LEFT JOIN MovimentosFuncionarios mf ON p.NumProc = mf.NumProc AND mf.IdLinha =1 WHERE mf.NumProc IS NULL Certifique-se de seguir as boas práticas mencionadas acima antes de executar os comandos. Com os melhores cumprimentos, **Esta resposta foi gerada pelo Cegid Pulse, com base na base na informação disponível em histórico.** Marked as spam |