foreign keys across databases

  • Hi

    I have a database and the is an area of that database that is concerned with housing.

    Now this almost a completely seperate area of the database and could probably benefit from being in its own database.

    The is a foreign key between one of its tables and a clients table in the main area of the database.

    If I seperated the database is there a way of keeping that key across databases?

    Thanks inn advance

  • Nope but you can enforce it with triggers.

  • You can't construct foreign keys between two different databases.

    If you want to maintain referential integrity, you will need to move those tables into the main database. If you have reasons to keep that set of data seperated out, such as security, use a different schema for those tables. If your reason for seperating the tables is more storage related perhaps have a look at creating seperated filegroups and place them in a seperated filegroup from the main data.

    Follow me on twitter @EvoDBACheck out my blog Natural Selection DBA[/url]

Viewing 3 posts - 1 through 2 (of 2 total)

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