Getting Duplicate Rows

  • Hi all,

    I'm Using SQL server 2005 Integration Services. I'm new to SSIS . When i transfer data first time i'm getting correct result. when i run the package next time. The number of rows in the destination table are getting doubled and all the rows of the second time run are duplicate rows.If i run the package third time i'm getting 3 duplicate entries

    Can any one help me to fix this issue?

    Regards

    guru

  • Hi,

    You need create a TASK at the starting point of the Package and name it as Truncate Task and this should be Execute SQL TASK and command should be TRUNCATE TABLE

    .

    Pradeep

  • The TRUNCATE option will work, but do you really want to delete everything from the table every time before you perform the import? Or maybe you want to import 'new' records and update/ignore those which already exist? It's all down to your business requirement.

    If you have some sort of unique identifier on your imported data (and you're a database guy, so you must have, right? :-)), you should consider adding a uniqueness contraint (eg, by making it a primary key) to the destination table which would ensure that duplicates cannot possibly be created. Your package will then, however, fail if you try to create duplicates unless you modify it to avoid or ignore this error.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Yes, As u told i'm not suppose to drop all the rows and reload. It should insert or update or ignore.

    Guru

  • I suggest that you read and follow this thread - it's relevant to what you are trying to achieve:

    http://www.sqlservercentral.com/Forums/Topic764541-148-1.aspx

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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