SSIS Package to import data to table with FK constraints

  • Hi all,

    Are there any best practices to follow when creating an SSIS package that imports data to a table that has FK constraint.

    The table in question has a FK contraint of around 500 sites, the file im importing contains these sites and many many more.

    I've created an SSIS package that takes the datasource file and imports it into the table and ignores any raised error messages. This works and the data is inputted but im sure there must be a better way of doing this where i dont have to ignore errors, etc.

    Cheers,

    Lee

    --
    I thought what I'd do was, I'd pretend I was one of those deaf-mutes.

  • When I have a table that has a Foreign Key column, essentially a child table, that I am loading using SSIS, I use a lookup transform to "weed out" rows that would violate the Foreign Key constraint. You can redirect those rows and create a parent record, ignore them, or log them in an errors table to sort out later.

    Jack Corbett
    Consultant - Straight Path Solutions
    Check out these links on how to get faster and more accurate answers:
    Forum Etiquette: How to post data/code on a forum to get the best help
    Need an Answer? Actually, No ... You Need a Question

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

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