Bienvenido a los foros de QnA.
Este foro es para discusiones en inglés. La interfaz aquí aún no es compatible con otros idiomas.
Usé el traductor de Google para entender tu pregunta, pero responderé en inglés. continuemos la discusión en inglés :-)
...
Welcome to the QnA forums.
This forum is for discussions in English. The interface here is not yet support other languages.
I used Google translator to understand your question, but I will answer in English. let's continue the discussion in English :-)
----------
Question in English: Cannot insert the value NULL into column 'Cod_Cli', table 'TrabajoFinal.dbo.History_Cli'; column does not allow nulls. INSERT fails.
M is presented with this error when executing the record
I have a storage process created for the insertion of new clients
a table that records the history of the client table
and a trigger for each time a new client is inserted, it fires and saves the event that happened with the affected table, that is, client
----------
Answer (English)
It seems like your table TrabajoFinal.dbo.Historial_Cli have a column named Cod_Cli
which is configure not be NULL like bellow sample
CREATE TABLE Cod_Cli (ColumnA int NOT NULL)
GO
In such column which is configured using "NOT NULL"
we cannot insert NULL and the following attempt will raise the error which you get
INSERT Cod_Cli (ColumnA) VALUES (NULL)
GO
-- Cannot insert the value NULL into column 'ColumnA', table 'tempdb.dbo.Cod_Cli'; column does not allow nulls. INSERT fails.
Option 1: ALTER the table to allow NULL
ALTER TABLE Cod_Cli
ALTER COLUMN ColumnA int NULL
GO
Now we can INSERT NULL
INSERT Cod_Cli (ColumnA) VALUES (NULL)
GO
Option 2: change your INSERT query and make sure that you do not INSERT NULL. You can use the function ISNULL to set the value you insert to something which is not NULL if the value is NULL
DECLARE @Input INT
INSERT Cod_Cli (ColumnA) VALUES (ISNULL(@Input, 0))
GO