We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Cross Database Foreign Key Relationship.

Medium Priority
383 Views
Last Modified: 2012-06-27
Hi,

I have separate database for Master and Transaction.
Due to creating the foreign key of different database, the message shows that it is not supported.

Is there any way (trick) to overcome this beside make them into one database?

Thank you.
Comment
Watch Question

CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
You can create a trigger to enforce the integrity between the 2 tables in the different dbs.

Author

Commented:
Hi chapmandew,

Very interesting.

How could we do it?

Thank you.
CERTIFIED EXPERT
Awarded 2008
Awarded 2008
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I see know, manual checking by application or trigger.

When user try to delete the data from the table of Master, then we should check it also it has been used by child table or not?

Thank you.
CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
yes, you'd definetly have to do that too....so, on the master, check for deletes and if they're in the other table.  on the transaction table, make sure any inserts or updates are in the master table...make sense?

Author

Commented:
Ok.

It is safe use kind of trigger?

Thank you.
CERTIFIED EXPERT
Awarded 2008
Awarded 2008

Commented:
sure...

Author

Commented:
Ok.

Thank you very much for your help.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.