1
I’m trying to insert data into a table:
INSERT INTO [RDO].[dbo].[observacaoProtocolos] (id_protocolo, statusObs1, observacao1, statusObs2, observacao2, statusObs3, observacao3, statusObs4, observacao4, statusObs5, observacao5, statusObs6, observacao6, statusObs7, observacao7, statusObs8, observacao8, statusObs9, observacao9, statusObs10, observacao10)
VALUES (153,'OK','','','','','','','','','','','','','','','','','','','')
However, a warning appears:
Unable to insert NULL value in column 'id_observacao', table 'RDO.dbo.observacaProtocolos'; column does not allow nulls. Failure in INSERT.
I created the table as follows:
CREATE TABLE observacaoProtocolos
(
id_observacao int NOT NULL,
id_protocolo int,
statusObs1 varchar(4),
observacao1 varchar(100),
statusObs2 varchar(4),
observacao2 varchar(100),
statusObs3 varchar(4),
observacao3 varchar(100),
statusObs4 varchar(4),
observacao4 varchar(100),
statusObs5 varchar(4),
observacao5 varchar(100),
statusObs6 varchar(4),
observacao6 varchar(100),
statusObs7 varchar(4),
observacao7 varchar(100),
statusObs8 varchar(4),
observacao8 varchar(100),
statusObs9 varchar(4),
observacao9 varchar(100),
statusObs10 varchar(4),
observacao10 varchar(100)
);
I think this modeling is very wrong. Why you need to have 10 pairs of status and observation fields?
– Leonel Sanches da Silva