Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Get back (Identity) ID to the other table in SSIS Data flow?

$
0
0

Table 1:

-------     -----                ----          ----

Name       Add                  No         RowID

-------     -----                 ----         -------

aa     #a-1,India                              10

bb     #a-1,India                              11                

aa     #a-1,India                              12

----------------------------------------------------

 table 1 inserting to Table 2 (Using 1st Data flow)

Table 2:

-------     -----                ----

Name       Add                 ID(Note:Here Identity1,1)

-------     -----                 ----

aa     #a-1,India                 1

bb     #a-1,India                 2

aa     #a-1,India                 3

----------------------------------------------------

My Requirement is Update  Table 1 set Column::No=Table 2.ID

                                                                        based on Exact Match of

                                                                         Table1.Name=Table2.Name  and

                                                                         Table1.Add=Table2.Add


It means Get back the Id for Source Table 1

 2nd Data flow

             Source(Table1:Name, Add,No)

                          |

   --LOOKUP(Table2:Name, Add::Matched Look Columns Name, Add and Tick Mark on ID)

                         |(Match)

   -->OLEDB Command: update Table1 set N0=? where  RowID=?(Here Param_0= NO ,Param_1=RowID)

Here My Issue is if  Table 1 had Duplicates(same Name, Add, but Row Id is different it is Updating Same ID for Table 1.No It means Get Back ID correctly not updating

Result::

Table 1:

-------     -----                ----          ----

Name       Add                  No         RowID

-------     -----                 ----         -------

aa     #a-1,India                1              10

bb     #a-1,India                2              11                

aa     #a-1,India              1              12

----------------------------------------------------

My correct Output is         3             instead of Result:Table1 1.NO  1             where RowID =12

It caused by LOOKUP , It picking Top1 ID while Matching Look on fields.

How Should I update the (Identity) Get Back Table 2.ID to Source Table1. NO  in Above logic in SSIS??????

Please help instead of LOOKUP , May I use SCD ???

Thanks



Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>