0

I want to insert into DB2 Database from SQL server using SSIS. The insert should happen multiple times in a day. Approximately need to insert 1 million records and needs to inserted short span. Tried using conditional split but need to find is it possible to have dynamic split based on the row count. for example if there are 50000 records there should be split of 10 with each batch size of 5000. Is there any possible bulk import into DB2 tables

1 Answer 1

0

If you would like me to expand on my answer, please feel free to ask for more technical details. Here is the initial idea:

Add a Execute SQL Command component is SSIS which get the min(Id) and max(id) or row count of the the data you want to insert into DB2.

  1. Save the min and max values in two Variables.
  2. Define another variable as you Pointer.
  3. Create an If Loop in SSIS which the looping condition is when @pointer < @max
  4. Get Top n of the records you want to insert and update the @pointer to the latest ID --> @pointer+n

This idea is suitable for situations where your IDs are consecutive and there are no missing or deleted numbers in between.
However, it can also be adapted for situations where the IDs are not in a consecutive order with using ROW_NUMBER() which in your case might reduces the performance a little bit while we are loading the data. But after loading the data into RAM, the rest will be fine.

Sign up to request clarification or add additional context in comments.

3 Comments

Can you brief me more about your idea. I have consecutive numbers how to use if loop in SSIS what is the component used for it
@Maevrick The video in this link is showing a very complete explanation of how to define a conditional loop in SSIS using variables: youtu.be/eE-d0g5V2aM?si=iD3xEFgbdEl6yf2R hope this would be helpful.
btw the name of the component is For Loop Container.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.