问题
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:
- Trigger to update data on another sql server
来源:https://stackoverflow.com/questions/9720962/sql-server-synchronizing-legacy-and-new-database-tables