question

aRookieBIdev avatar image
aRookieBIdev asked

Update Statement in SSIS

Hi, I have a scenario where i am moving 40 million records in to a table and then run a update script to update some records with the aggregate values example total count for each countries. Since i cant calculate these values in run time.(not the total of 40 million) What is the best alternative solution rather than updating 40 million records. Thanks in advance, Kannan
ssisupdateperformance-tuning
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sp_lock avatar image sp_lock commented ·
Does the update evaluate the entire 40 million rows or you what have a WHERE statement?
0 Likes 0 ·
Fatherjack avatar image Fatherjack ♦♦ commented ·
can you give us a description of the calculations that you are needing to apply so we can make suggestions?
0 Likes 0 ·
aRookieBIdev avatar image aRookieBIdev commented ·
i want to calculate the total value of a coulmn based on the country . example total for US , total for europe etc.
0 Likes 0 ·

1 Answer

·
Valentino Vranken avatar image
Valentino Vranken answered
If you're calculating totals, why would you want to store them in the same table as the details? To avoid updating those 40 million records, you could store the totals in a separate table, something like CountryTotal. You'd need two fields: CountryID and Total. Or better, three fields, add a primary key CountryTotalID as well. This assumes your details table already has a CountryID. If that's not the case, you may want to consider remodeling a bit by creating a Country table that contains the list of countries. Your details table would then point to this new table.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.