Doubt for database structuring - SQL Server

Asked

Viewed 48 times

0

Good night!

I would like to ask for help to have some ideas, I will explain more or less what I would like:

Let’s say I have two databases, one to serve as Central (receives information from various other databases), and one that receives information from the system, and sends it to the Central Bank.

Okay, what can happen is that the local bank doesn’t send any information to the central bank, and that leaves some gap. What I would like to do is a "check" of the amount of information between the two banks.

What I thought I’d do:

  • Create a central bank table, with information on the amount of information from the local, central bank and which table is being verified. Right, the idea was to create a Procedure to check when there was disagreement, and then submit a request to the local bank to try to raise the missing information, my question would be, how could I specifically report what information is missing? They would have tips to structure better?

In the first picture it would be an example of information, and how they might be divergent. In the second how would be the basic structure of the table to verify.

The problem is that many tables do not follow a numerical sequential pattern (many have some columns like PK). I thought of creating another column in the table to leave the total sum of something, and with that, validate which value is missing (in the example, would be added the (1,2,4), resulting in 7, and would compare with the sum of the local bank that would be 10, with that would take the difference and send the request to the local bank to send the divergent value information.

Demonstração

inserir a descrição da imagem aqui

  • Why don’t you use the bank’s own replication functions? It looks like you’re trying to reinvent the wheel.

  • https://docs.microsoft.com/en-us/sql/relational-databases/replication/sql-server-replication?view=sql-server-ver15

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.