The value violated the integrity constraints for the column

By | April 12, 2016 | 4 Comments
Category: SSIS Tags: ,

If you happen to get an 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. If the source is table or in any other easily verifiable format, you can visually look at it. If the source is Excel, it is a bit tricky.

When the source data comes from Excel file and you get this error, it means that either blank rows exists somewhere in the middle of data or at the very end. Even though visually you will not be able to verify if the blank rows exists in Excel or not, try to select all the blank rows all the way upto the last Excel row, right click on the selection and press “Delete” to delete it, save the file and rerun the SSIS package again.

Hopefully this would solve your problem.

About Vishal Monpara

Vishal Monpara is a full stack Solution Developer/Architect with 13 years of experience primarily using Microsoft stack. He is currently working in Retail industry and moving 1's and 0's from geographically dispersed hard disks to geographically dispersed user leveraging geographically dispersed team members.

4 thoughts on “The value violated the integrity constraints for the column

  1. Vishal Monpara Post author

    Hello Mita,

    If the column is mandatory, most of the time, you need to replicate the business logic at the time of insertion and insert data. If it is not possible, place a dummy/invalid data and update dummy/invalid data in subsequent steps within SSIS. You may want to handle scenario if package fails before dummy/invalid data is updated with valid data. There is also another possibility where you may want to insert the records in a staging table first. You may keep staging table columns optional. Once data is inserted into staging tables and validated, you may want to populate the column with valid data. Then populate real table from staging table data.

    Vishal Monpara

  2. Mita Kumari Nayak

    When the column will be mandatory , what will write for that column?


    there were blank rows in my excel, which resolved the issue.
    Thank You very much!

Leave a Reply

Your email address will not be published. Required fields are marked *