terça-feira, 3 de julho de 2012

Integration Services - Sincronização entre duas tabelas de diferentes bancos de dados.

Veja bem,

Se você está tarado para usar o replicatedo SQLServer para sincronizar duas tabelas de bancos diferentes, controle-se!

Ao invés disso, utilize o integration service, é bem mais elegante. Usar replicate para sincronizar tabelas de bases diferentes é o mesmo que assassinar uma mosca usando um asteróide.

Ao invés disso, veja este exemplo


There are situations where a SQL Server DBA needs to keep two different tables in sync. Usually, the DBA needs to keep a copy of a table in a in a data warehouse repository that is used as a solution for archiving and/or reporting.
SQL Server provides a robust method for keeping data synchronized across databases using Replication but there are situations when all we need is just to keep an online copy of a single table for archiving or reporting purposes and we would prefer to do not tinker into SQL Server replication.
This post is divided into two parts: Part I explains how to update a destination table with the information that is added into a source table while Part II explains how to replicate any change that happens in existing records in the source table into destination. Please, take into account this is just another way of doing this, there are many other possibilities but the one listed here is probably one of the fastest to implement and modify on-demand.
This procedure is based on the following scenario: A “table A” on “database A” is periodically replicated using SSIS into “table B” on “database B”. “Table A” is updated with new records and we need to copy those records into “table B” too. Our final implementation will look like this in SQL Server Business Intelligence Development Studio:


http://blogs.msdn.com/b/jorgepc/archive/2010/12/07/synchronize-two-tables-using-sql-server-integration-services-ssis-part-i-of-ii.aspx

That's folks!


Nenhum comentário:

Postar um comentário