Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 incremental load. SSIS

Author  Topic 

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2009-03-10 : 13:34:05
I have a package that does incremental Loading. Let's say it fails in the middle of inserting 50K records. However 20K records is inserted. TableA has many million records and many fields. How could I get get the missing 30K records to tableA.
I could use a temp table and manually re-run the package to insert all the 50K records into it. Then use a join to insert the missing 30k records to tableA. However I will have to write a new SSIS package to do this and map the fields again. So much hassle. TableA has constraints and keys. What is a good approach to retrieve those missing 30k records?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-10 : 13:53:33
the best approach is to put all tasks associated with insertion within a sequence container and make transaction property of container as required. this will launch a new transaction each time the tasks within sequence container executes and if any error happens in between all changes get rolled back and next time you can start from beginning itself.
Go to Top of Page

tmitch
Yak Posting Veteran

60 Posts

Posted - 2009-03-10 : 13:54:56
You could use the Error Output of your destination to write out the errored rows to a separate table rather than fail the package. You could then address only those rows in the Error table rather than re-running your entire set of data.

The alternative is to do a lookup on the target table, assuming there is a distinct value you can check, to verify that the record doesn't already exist. However, doing a lookup on a 1m row table could get expensive.

hth,
Tim

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

Tim Mitchell
www.BucketOfBits.com
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-10 : 14:25:21
for comparing and inserting only non existent records you can use this,

http://www.sqlis.com/post/Get-all-from-Table-A-that-isnt-in-Table-B.aspx

but i prefer the transaction method specified earlier
Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2009-03-10 : 14:46:49
visakh16,
we won't use transaction as they look up the tables. That link wont work with over 10M records. It would be really slow.
Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2009-03-10 : 14:49:10
quote:
Originally posted by tmitch

You could use the Error Output of your destination to write out the errored rows to a separate table rather than fail the package. You could then address only those rows in the Error table rather than re-running your entire set of data.



It says cannot be set to redirect....then there is a red dot with a white X on the OLEDB destination
Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2009-03-11 : 13:35:32
tmitch,
I was using fast table load. Changed it back to "table or view" and it works now. Thanks man
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-11 : 14:17:29
quote:
Originally posted by basicconfiguration

visakh16,
we won't use transaction as they look up the tables. That link wont work with over 10M records. It would be really slow.


sorry didnt get that. what's the problem with using transaction?
also did you try using left join method in link?
Go to Top of Page

basicconfiguration
Constraint Violating Yak Guru

358 Posts

Posted - 2009-03-11 : 14:27:36
I don't want to use Transaction is because Transaction locks up the table while other users want to read this table. Yeah I can use left join too. I have a unique field new_ID() type in the stage and final table.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-03-12 : 13:50:10
ok..
Go to Top of Page
   

- Advertisement -