locked
Inserting 01/01/1900 to a NOT nullable date field RRS feed

  • Question

  • When I try to do that I get an 'The value violates the integrity constraints for the column' because SSIS thinks 01/01/1900 is equivalent to a null date? Is there a workaround to this? Thank in advance.

     

    I am importing from an Excel file to a SQL 2008 database.

    Monday, March 7, 2011 3:31 PM

Answers

  • It must be a constraint imposed on the database level.

    Specifically on this table column to not to allow special values and/or there is a Foreign Key on it or there is a Unique Constraint on it.

    You should see the table, how it is designed.

     


    Arthur My Blog
    By: TwitterButtons.com
    • Proposed as answer by Todd McDermid Tuesday, March 8, 2011 5:13 PM
    • Marked as answer by Tony Chain Monday, March 14, 2011 4:21 PM
    Monday, March 7, 2011 6:56 PM

All replies

  • No, the style is not correct. What datatype ist this? Date or string?

    If string try "1900-01-01"

    if date, that should work, maybe you have to use a Data Conversion

    Monday, March 7, 2011 3:54 PM
  • Thanks for the response!

     

    '01/01/1900' is exactly how the data is in the excel. I used the Data Conversion box too and tried all different 'dates' like the DT_DATE, Database_Date etc., but same result. Are you asking me to replace all 01/01/1900 with 1900-01-01 in the excel file?

    Monday, March 7, 2011 4:05 PM
  • It must be a constraint imposed on the database level.

    Specifically on this table column to not to allow special values and/or there is a Foreign Key on it or there is a Unique Constraint on it.

    You should see the table, how it is designed.

     


    Arthur My Blog
    By: TwitterButtons.com
    • Proposed as answer by Todd McDermid Tuesday, March 8, 2011 5:13 PM
    • Marked as answer by Tony Chain Monday, March 14, 2011 4:21 PM
    Monday, March 7, 2011 6:56 PM
  • If the constraint does not exist on the table, what data type does SSIS think that excel column is?
    Rgds Geoff
    Monday, March 7, 2011 10:18 PM