Hi all!
Happy New Year!!!!
here looking for insert and update with difference in two tables. Depends upon on the value of the source and destination table, update statement should execute.
For example
[ Dest Table logistic in ('SB','TR') and Src Table b.logistic in ('SC','','RC','RB') ]OR [ Dest Table logistic in ('SB','TR') and Src Table b.logistic in ('SC','','RC','RB') ] then update Src valueb.logistic otherwise retain dest value.
Sample Script
updateDest_tab Logistic= case
whena.logistic in ('SB','TR') and b.logistic in ('SC','','RC','RB') then b.logistic
when isnull(a.logistic,'')='' andb.logistic in ('RB','SC') then b.logistic
else a.logistic end
Location= case
when a.logistic in ('SB','TR') and b.logistic in ('SC','','RC','RB') then b.Location
when isnull(a.logistic,'')='' and b.logistic in ('RB','SC') then b.Location else a.Location end,
SentBy = case
when a.logistic in ('SB','TR') and b.logistic in ('SC','','RC','RB') then b.SentBy
when isnull(a.logistic,'')='' and b.logistic in ('RB','SC') then b.SentBy
else a.sentby end,
SentTo = case
when a.logistic in ('SB','TR') and b.logistic in ('SC','','RC','RB') then b.SentTo
when isnull(a.logistic,'')='' and b.logistic in ('RB','SC') then b.SentTo
else a.SentTo end, fromDest_tab a join Src_tab b a.pk_id=b.pk_id
......
my Data flow Task is
1.two OLE DB Sources
2.Mege Join (PK_ID -join key)
3.Conditional spilit
a.Insert case - isnull(DstPK_ID)
b.Update case -?
4.OLE DB Destination for insert and OLE DB Command for update.
now need guide for Update case expression. and any good method to implement this..
Thanks regards with
T KUMAR