Matched and Unmatched Rows in ssis 2005

  • Hi,

    Need to transfer data from database Db1 (Db1.sampletab1) to database Db2 (Db2.sampletab2) using ssis 2005.

    Condition:

    If matched data, leave as it is.

    If unmatched data, then insert the records into DB2.sampletab2

    Is this possible in SSIS 2005? If yes, could you please let me know the steps?

    CREATE TABLE [dbo].[sampletab1](

    [pKey] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,

    [SasId] [nvarchar](max) NULL,

    [Name] [nvarchar](max) NULL,

    [TypeId] [nvarchar](max) NULL,

    [UserName] [nvarchar](max) NULL,

    [CreatedDateTime] [datetime] NULL,

    [CompletedDateTime] [datetime] NULL,

    [Boolean] [bit] NULL,

    )

    insert into sampletab1 values('sdf','werwer','s233','xzfdsdf',12/11/2011,14/11/2011,'TRUE')

    Regards

    SqlStud

  • sqlstud (10/4/2012)


    Hi,

    Need to transfer data from database Db1 (Db1.sampletab1) to database Db2 (Db2.sampletab2) using ssis 2005.

    Condition:

    If matched data, leave as it is.

    If unmatched data, then insert the records into DB2.sampletab2

    Is this possible in SSIS 2005? If yes, could you please let me know the steps?

    CREATE TABLE [dbo].[sampletab1](

    [pKey] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,

    [SasId] [nvarchar](max) NULL,

    [Name] [nvarchar](max) NULL,

    [TypeId] [nvarchar](max) NULL,

    [UserName] [nvarchar](max) NULL,

    [CreatedDateTime] [datetime] NULL,

    [CompletedDateTime] [datetime] NULL,

    [Boolean] [bit] NULL,

    )

    insert into sampletab1 values('sdf','werwer','s233','xzfdsdf',12/11/2011,14/11/2011,'TRUE')

    Regards

    SqlStud

    Very much possible.You can simply handle it by writing except query or you can also use conditional split.

    However few query here.

    1. How you are recognising new record means what is the unique field.

    2. Why are you leaving existing record as in ideal scenario we usually update the old records i.e. genearally we use UPINSERT logic for this type of scenario.

    --rhythmk
    ------------------------------------------------------------------
    To post your question use below link

    https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help
    🙂

  • Thanks Rhythmk..

    I have loaded unmatched data via Erroroutput

    Regards

    Sqlstud

  • Option - 1: You can make use of LookUp and Condition Split Transformation to achive this.

    Option - 2: You can do this by Creating a Procedure.

    A. Load all the data's to Staging Table.

    B. Create Procedure and load latest data's, by Comparing Staging and Fact table data's and then load the latest data's.

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

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