SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Get values from two similar tables with Join condition


Get values from two similar tables with Join condition

Author
Message
rsoria.03
rsoria.03
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 57
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.
a4apple
a4apple
SSC Veteran
SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)SSC Veteran (256 reputation)

Group: General Forum Members
Points: 256 Visits: 406
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 Smile .. Visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles.
rsoria.03
rsoria.03
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 57
Thanks it works perfectly for my situation BigGrin
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search