Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Adding a FK to a data set Expand / Collapse
Author
Message
Posted Saturday, April 19, 2014 12:15 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 6:17 AM
Points: 383, Visits: 572
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...
Post #1563275
Posted Saturday, April 19, 2014 12:26 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:08 AM
Points: 7,147, Visits: 13,213
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
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1563276
Posted Saturday, April 19, 2014 12:45 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 6:17 AM
Points: 383, Visits: 572
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...
Post #1563277
Posted Saturday, April 19, 2014 12:53 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:08 AM
Points: 7,147, Visits: 13,213
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
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1563278
Posted Saturday, April 19, 2014 1:00 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 6:17 AM
Points: 383, Visits: 572
Will try, thanks.

There is an exception to every rule, except this one...
Post #1563280
Posted Saturday, April 19, 2014 1:15 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: 2 days ago @ 6:17 AM
Points: 383, Visits: 572
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...
Post #1563282
Posted Saturday, April 19, 2014 1:24 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:08 AM
Points: 7,147, Visits: 13,213
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
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #1563283
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse