SSIS, preserving foreign key constraints.

Last post 09-28-2009 11:54 PM by wmec. 1 replies.

Sort Posts:

  • SSIS, preserving foreign key constraints.

    09-24-2009, 10:58 AM
    • Member
      4 point Member
    • Frederick
    • Member since 11-07-2007, 7:52 PM
    • Posts 40

    Hi, all.

    For the past few days, I've been trying to use SSIS to migrate data in tables from a SQL Server database to an Oracle database. I need to retain foreign key constraints while doing it. I'm not in a position to remove foreign key constraints, then add them back.

    The problem is that each of the foreign keys I'm using are newly generated GUIDs (created by SSIS).
     

    Example:

    I have two tables, "ShipClass" and "Ship". ShipClass contains a foreign Key pointing to Ship. That means the Ship table is loaded first, then ShipClass.
    In the first dataflow, Ship is loaded appropriately in its' table - with a new Guid for its' foreign key field. ShipClass is loaded next, but the column containing the foreign key pointing to Ship always has a newly generated Guid.

    The problem:
    ShipClass has a FK relationship to Ship - both of their Guids absolutely have to be the same. I need a way to preserve foreign key constraints when I'm loading two different tables in SSIS.

    I can't figure out how to do this. Can I get some help?

    Filed under: , ,
  • Re: SSIS, preserving foreign key constraints.

    09-28-2009, 11:54 PM
    • Contributor
      2,627 point Contributor
    • wmec
    • Member since 12-20-2007, 1:36 AM
    • China
    • Posts 1,603

     You can disable the FK constraints when loading the data and enable that once the data has been loaded

    Many Thanks & Best Regards,
    HuaMin Chen
    (If you mark it then it means the post is helpful/meaningful for other people's reference in the future!)
Page 1 of 1 (2 items)