May 24, 2014

I am importing an excel spread sheet to sql server database but for some reason I am getting the error “The value violated the integrity constraints for the column”. I checked the table data type and it should really just work but could not get it to work.

After some investigation I noticed that one of the rows in the excel does not have a value and when this is imported to the sql table, this column is treated as null. Also, since I was not expecting null values for this column – I didn’t set it to allow for nulls. Changing the column to accept null fixed the issue.

Similar to previous post, importing an excel to sql table is reasonably easy if the data types for the columns are set correctly.


Reference: Shahed Kazi at