SSIS question

  • SSIS newbie

    Trying to import a new employee list from a flat file into an SQL table with SSIS. My problem is that my flat file does not have an entry for a column that does not accept nulls, so the package fails with "value violates integrity constraint"

    I'll try to explain further with a simplified example. Let's say the destination table has three columns: ID, FirstName, LastName. ID is the primary key, its an identity and SQL auto assigns the ID. My source file only has first name and last name, so the package fails with the above error message. My problem is that the HR system that spits out the new employee file does not know what the next available ID is, so there is no way I can add this to the source file. Also, in my actual task, I have to address other columns in the table also flagged as not nullable, which are not in the source file. These are autopopulated based on a corresponding default value; how can SSIS tap into these default values so I don't have to account for them as columns on my source file?

    Thanks

  • Well, in the example you provide, you state that not passing a value to an Identity based ID column is causing a problem and that is impossible. You would actually get an error if you did provide a value for that column unless you set Identity_Insert ON.

    I would use a Derived Column transform to add any non-nullable columns to my source dataset before inserting into the SQL Server table.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply