SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Aug 2004
    Location
    portugal
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question relations between two databases?

    Hi,

    anyone knows if it's possible to have relations (constraints, foreign keys) between to db's.
    for example, can i have in table a from db aa, a field that have a constraint to field on table b, from db bb.

    thanks

  2. #2
    SitePoint Addict silent's Avatar
    Join Date
    Jun 2004
    Location
    Roaming North America
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gmx2
    Hi,

    anyone knows if it's possible to have relations (constraints, foreign keys) between to db's.
    for example, can i have in table a from db aa, a field that have a constraint to field on table b, from db bb.

    thanks
    In MySQL, no. It allows for table and column name only (backticks after version 3.23.50.

    In SQLServer2000, I believe the only way to implement this still is to have an BEFORE INSERT/UPDATE trigger query the appropriate db for existence.

    I've needed this in the past, but then an (at the time ) more enlightened colleague had said to me:

    "If the data in one database should be constrained by the data in another database, why are there two databases at all? The definition of a database in one sense of the word is a collection of all related data..."

    hth,

    jay


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •