• 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
    🙂