Sql Server 2008 Crosstab Table Tables (Relations)

I have a bit of a problem, and frankly, I don’t think there is an answer, but I will try anyway.

So, I have two databases [A] → Company and [B] → Product. Both databases have a Country table, which is then mapped to other tables in each individual database. The problem is that the data between the two country tables is a complete duplicate. Thus, I, in fact, have to duplicate some relationships in each database, and maintenance on top of this is simply difficult ...

So, I'm curious if there is a way to create a relationship between databases between tables, so I can only have one set of Country + Helper tables that manage both databases?

Thanks in advance!

+3
source share
5 answers

Well, can you think of having one transaction database and two databases for saving data? It’s a lot of work, but it seems like the best viable option - will every transaction in a write cause a write to each of the “read” databases? Maybe I'm not sure I understand the question?

+2
source

You cannot have physical relationships that span multiple databases to ensure FK restrictions.

Search tables / auxiliary tables can still be stored in one database, but you just need to set the FK limit on it from tables in other databases - a logical assumption, not a physical restriction.

+4

. , .

0

Store in the 1st table of the database and create a view from this table in the 2nd database

0
source

Yes. Save the Country table in the 1st database and create a view in the country1 table of database1 in database2. No physical data exists, so there is no need to panic.

0
source

Source: https://habr.com/ru/post/1729982/


All Articles