Get values from two similar tables with Join condition

  • Hi everybody, I have an issue with the join of two tables without PK. Both are in two different servers and it structure is similar to this:

    Cembarcador| Cemisor | Fremision | Remision | Tranportista | Volnat | Vehiculo | Cfacturador | Dfacturar |

    690 | 68750 | 2013-12-31 00:00:00.000 | 287143 | NULL | 31.5010 | PR0179 | 300 | 99999 |

    690 | 68750 | 2013-12-31 00:00:00.000 | 287144 | NULL | 29.4990 | PP113 | 300 | 99999 |

    620 | 65750 | 2013-12-31 00:00:00.000 | 683830 | NULL | 27.7150 | PVI0001 | 300 | 99999 |

    620 | 65750 | 2013-12-31 00:00:00.000 | 683831 | NULL | 31.4930 | PVI0001 | 300 | 99999 |

    649 | 66750 | 2013-12-31 00:00:00.000 | 252927 | NULL | 31.0010 | PR3863 | 300 | 99999 |

    Cembarcador (int, not null)

    Cemisor (int, not null)

    Fremision (datetime, not null)

    Remision (numeric(12,0), not null)

    Tranportista (varchar(50), null)

    Volnat (numeric(12,40), null)

    Vehiculo (varchar(20), null)

    Cfacturador (int, null)

    Dfacturar (int, null)

    My problem is that I need to synchronize them using SSIS in order to know if exist any changes in the rows on the Destination DB or if exist the row in the Destination DB (comparing it with a main DB). I've done some tests but when I run the package it generates an infinite loop in the "Left Outer Join" part. I'm limited, I can't change the structure of the tables or database)

    I'll appreciate any kind of help or ideas to solve this. Thank you.

  • If you are planning to sync to database tables between two different databases, you must be thinking of incremental data loads. In your case as I see it, may be a combination of (Cembarcador , Cemisor , Remision) may be used as a key to check the data.. I am not sure though too...

    Take a look into this.. http://sqlblog.com/blogs/andy_leonard/archive/2007/07/09/ssis-design-pattern-incremental-loads.aspx

    Good Luck 🙂 .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.

  • Thanks it works perfectly for my situation 😀

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply