Wednesday, August 26, 2020

SSIS Error : The value violated the integrity constraints for the column

 While Executing SSIS package getting error "The value violated the integrity constraints for the column" .

It means that it tried to insert null value into the non nullable column in the database. What you want to do is check the table definition of the destination table for any integrity constraints like NOT NULL or PRIMARY KEY.

You can distinguish from whether violation due to Not NULL or Primary Key by looking at Error column.

Generally if Error column is 0 (zero) then it is a PK violation otherwise it is a Not NULL key violation.

So need to analyze source data and correction if required.

Saturday, August 22, 2020

Altering a column from Not NULL to NULL in SQL server

 Need to alter a table to allow NULL on a column. Not required to drop the column

Please use below script in SQL server.

ALTER TABLE tableName ALTER COLUMN columnname varchar(50) NULL

Please go through details of NOT NULL constraint