title: TSQL - Data pass between DB
body: <p>TSQL - Data pass between DB</p>
  
  <p>Hello,</p>
  
  <p>as indicated in the subject I'm informing me how to make the transfer of data between two different software.
  Each with a SQL Server DB. Most likely they are on the same server, so only different times and I can access them both. If the DBs are on different networks, I will implement a VPN.</p>
  
  <p>Example:
  In the "anagrafica" table of the "DB_a" I have the client's personal data (name, surname, birth, sex ...)
  In the "anagrafica" table of the "DB _b" I do not have this registry yet.</p>
  
  <p>-Then I would like to pass from the "DB_a.anagrafica" to the "DB_b.anagrafica" this record, obviously with id MAX (DB_b.id) because in the table "DB_b. Registry" there are already records with the relative id. (CASE INSERT);</p>
  
  <ul>
  <li><p>Or if a data is updated on DB_a.anagrafica, the update must be performed on the "DB_b.anagrafica" fields;</p></li>
  <li><p>In case a new record must be inserted in a weak table of "DB_b", ex. "DB_b.pagamenti" there is a unique id of the table and an external key that points to the id of the strong personal data table; (maybe the data in the weak table could have two more fields start_date and data_fine), this table is 1: N</p></li>
  </ul>
  
  <p>-The two DBs have been written by two different software houses so most likely the field types may differ. (characters, numeric, date and time, etc. ..) then CAST, CONVERT etc.</p>
  
  <ul>
  <li>In the end there could also be a return figure to complete the whole es. from "DB_b". registry to "DB_a.anagrafica".</li>
  </ul>
  
  <p>That said there is a software that already exists that puts you in the middle of the two DB is an interchange? (most likely to be scheduled with windows scheduler). Or a store procedure.</p>
  
  <p>Do you have more directions to give me?</p>
  
  <p>Thanks in advance</p>