Now have 2 databases (corresponding to two site data), respectively, for the database A and database B,
Database A table prefix for git, database B prefix for MAC
Two member has a set of data, data structure, can only say that similar but definitely different
Now want to have two members in the database data synchronization, how should do?
For a great god to explain!
CodePudding user response:
Is a one-off, or timing synchronization every day? Still want real-time second level synchronization?
CodePudding user response:
reference 1/f, gypsy song response: is a one-off, or timing synchronization every day? Still want real-time second level synchronization? real-time synchronization CodePudding user response:
refer to the second floor dh6276637 response: Quote: refer to 1st floor gypsy song response: is a one-off, or timing synchronization every day? Still want real-time second level synchronization? Real-time synchronization In not on the same server? CodePudding user response:
reference gypsy song reply: 3/f Quote: refer to the second floor dh6276637 response: Quote: refer to 1st floor gypsy song response: is a one-off, or timing synchronization every day? Still want real-time second level synchronization? Real-time synchronization In not on the same server? in CodePudding user response:
That can link to the server, and then each member data table to write a trigger, with related members information update server data link to change triggers CodePudding user response:
Dh6276637 reference 4 floor response: Quote: refer to the third floor of gypsy song response: Quote: refer to the second floor dh6276637 response: Quote: refer to 1st floor gypsy song response: is a one-off, or timing synchronization every day? Still want real-time second level synchronization? Real-time synchronization In not on the same server? in On the same server is convenient, (not on the same server to worry about the problem of network impassability failure occasionally) # 5 said link to the server is not needed, Write a trigger to synchronization, CodePudding user response:
refer to 6th floor gypsy song response: Quote: refer to 4th floor dh6276637 response: Quote: refer to the third floor of the gypsy song response: Quote: refer to the second floor dh6276637 response: Quote: refer to 1st floor gypsy song response: is a one-off, or timing synchronization every day? Still want real-time second level synchronization? Real-time synchronization In not on the same server? in On the same server is convenient, (not on the same server to worry about the problem of network impassability failure occasionally) # 5 said link to the server is not needed, Write a trigger to synchronization, this specific how to write, because it is not the same as the data structure CodePudding user response:
Basic is the following train of thought, specific what do you put the name change is about, -============================================= - the Author: - the Create date: 2020-03-29 - Description: synchronize on the same server different libraries of different structure of the two tables -============================================= CREATE the TRIGGER dbo. Trig_git_I_U ON the git AFTER INSERT, DELETE, UPDATE AS The BEGIN SET NOCOUNT ON; IF the EXISTS (SELECT 1 FROM INSERTED) The BEGIN - insert IF NOT the EXISTS (SELECT 1 FROM does) The BEGIN INSERT INTO dbB. Dbo. MAC (c1, c2) SELECT c1 and c2 FROM the dbA. Dbo. Git END - update The ELSE The BEGIN The UPDATE B SET the biggest 1=A.c 1 The FROM dbB. Dbo. MAC AS B INNER JOIN dbA. Dbo. Git AS A ON B.i d=Anderson d END END - delete The ELSE The BEGIN The DELETE B The FROM dbB. Dbo. MAC AS B INNER JOIN dbA. Dbo. Git AS A ON B.i d=Anderson d END END GO CodePudding user response:
reference gypsy song on the eighth floor response: is the following basic train of thought, specific what do you put the name change is about, -============================================= - the Author: - the Create date: 2020-03-29 - Description: synchronize on the same server different libraries of different structure of the two tables -============================================= CREATE the TRIGGER dbo. Trig_git_I_U ON the git AFTER INSERT, DELETE, UPDATE AS The BEGIN SET NOCOUNT ON; IF the EXISTS (SELECT 1 FROM INSERTED) The BEGIN - insert IF NOT the EXISTS (SELECT 1 FROM does) The BEGIN INSERT INTO dbB. Dbo. MAC (c1, c2) SELECT c1 and c2 FROM the dbA. Dbo. Git END - update The ELSE The BEGIN The UPDATE B SET the biggest 1=A.c 1 The FROM dbB. Dbo. MAC AS B INNER JOIN dbA. Dbo. Git AS A ON B.i d=Anderson d END END - delete The ELSE The BEGIN The DELETE B The FROM dbB. Dbo. MAC AS B INNER JOIN dbA. Dbo. Git AS A ON B.i d=Anderson d END END GO ok, thank you, I study the