views:

143

answers:

1

I have two databases (SQL Server 2005) with the same table schemes. I need to copy data from source table to destination with some modification of data along the way.

And if destination table already contains some data, then rows from source table should not override, but be added to the destination table.

In our project we use LLBLGen and LINQ to LLBLGen to as ORM solution.

Example:
    Database 1        Database 2                   Database 1
    Table 1:          Table 1:                     Table 1:
    Key Value         Key Value                    Key Value
    1   One           1   T2_One       Result=>    1   One
    2   Two           2   T2_Two                   2   Two
    3   Three                                      3   Three
                                                   4   T2_One
                                                   5   T2_Two
A: 

I would create a View of Table 2 in DB1 (you can create a view of a table from another DB), generate the code with LLBL GetPro and make a query to select the values from the view that are not present in Table 1. Then you can save those retrieved values in Table 1.

uvita
Would not work for me, the values may be the same. I thinks this solution a little bit complicated and I need to receive full control over data, so I will be able to change whatever data I want before inserting it to the destination table.
StreamT