Adding a FK to a data set

  • I'm really struggling with how to figure out adding in a FK constraint during a process that gets data from one sever and inserts into another. I've tried derived column, lookup, and just sql scripts. Any of the three may work, but I can't figure out any of them. Some direction would really be appreciated.

    There is an exception to every rule, except this one...

  • There's very little information so far...

    Where's the table holding the primary key you want to reference again?

    Is it in the source or the target database?

    What does the process look like? Please provide more details.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • I'm executing a package on server 1 that runs a query on server 2 for job history and inserting results back to server 1. The table being inserted into on server 1 has a fk relationship that I'm trying to get during this process.

    There is an exception to every rule, except this one...

  • Why don't you just use a conditional split with a left outer join to the table holding the primary key. Check for NOT NULL of the PK value and perform the insert.

    Do whatever needs to be done with the rows not matching the PK.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • Will try, thanks.

    There is an exception to every rule, except this one...

  • LutzM (4/19/2014)


    Why don't you just use a conditional split with a left outer join to the table holding the primary key. Check for NOT NULL of the PK value and perform the insert.

    Do whatever needs to be done with the rows not matching the PK.

    Can't figure out how to use a conditional split with a left outer join to the table holding the primary key. Can you be more specific please?

    There is an exception to every rule, except this one...

  • maybe this link will help you to figure it out...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

Viewing 7 posts - 1 through 6 (of 6 total)

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