SQL Server: Synchronizing Legacy and New Database Tables

柔情痞子 提交于 2020-01-05 08:48:13

问题


We have a database [NDB] which has migrated records from legacy database [LDB]. Tables in [NDB] has columns in the tables in [LDB] and some new columns. However the column naming standard is different in [NDB]. The prefix “tlb” is removed from table names in [NDB] as well as underscores are removed from column names in [NDB].

The [NDB] is loaded using SSIS with [LDB] as the source. The [NDB] is SQL Server 2008 whereas [LDB] is SQL Server 2000

There were two applications using legacy DB [LDB]. 1) Scheduling 2) Invoicing. We are moving the (new version of ) Scheduling application over to new database [NDB]. However the invoicing application will remain in [LDB].

There are some tables used by both of these applications( E.g. tblMyTable). When tblMyTable is updated by Invoicing application, the “MyTable” in [NDB] also should be updated.

I cannot use log shipping since the table and column names are not same.

I tried with CLR Trigger and got burned myself. These tables have identity columns. Suppose there happens an exception in invoicing application (which is connected to legacy database [LDB]) during insertion into tblMyTable. The insertion does not happen; however the identity seed value is increased. During the next insert the data in tblMyTable and MyTable will be out of sync.

Note: There are no CreatedDate/CreatedBy/LastModifiedBy/LastModifiedDate columns in tables in legacy db [LDB].

So, what is the best solution to adopt here?


READING:

  1. Trigger to update data on another sql server

来源:https://stackoverflow.com/questions/9720962/sql-server-synchronizing-legacy-and-new-database-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!