If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 - Moving Data from Staging to Live Table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-22-11, 13:31
rreword rreword is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
DB2 - Moving Data from Staging to Live Table

Hi,

We have small data warehouse with 26 tables, after ETL process we would like to load data into Staging table with I, U & D flag for insert, update and delet flag with each record in Staging tables.

Now my question is what is best/optimal method to load data from staging table to live tables?

I been told to use SQL statements to load data as utilities are not allow at this organization.

Is thee way to do Mass update and Mass Insert using SQL to load data? How?

Thanks in advance for your help,

Ree
Reply With Quote
  #2 (permalink)  
Old 07-22-11, 17:26
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Have a look at MERGE statement

cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 07-22-11, 18:49
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
I hope you will be allowed to use LOAD utility (db2 load). As otherwise with SQL commands like INSERT , UPDATE its going to take long time as they are logged. You can also opt for not logged initially option, but with restriction.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #4 (permalink)  
Old 07-22-11, 18:54
rreword rreword is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
Thanks for reply...

Is MERGE can handle mass update or insert?
Reply With Quote
  #5 (permalink)  
Old 07-22-11, 19:16
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
MERGE operations are also logged by default. So for mass INSERT / UPDATE using MERGE if you want to do, you need to turn off logging in the database table otherwise you can be very soon run out of transaction logs.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #6 (permalink)  
Old 07-25-11, 18:39
rreword rreword is offline
Registered User
 
Join Date: Jul 2011
Posts: 7
How Commit will be handled in MERGE? Is by number of records or ALL-In or ALL-Out is case of failure?

Just side question, I know Load utility is out of question but just want to make sure I got it right. DB2 Load utility will handle only bulk INSERTs but for Update I have to use UPDATE command. Is my understanding correct?

Thanks all for your time and reply.

Rwe
Reply With Quote
  #7 (permalink)  
Old 07-26-11, 03:34
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Quote:
Originally Posted by rreword View Post
How Commit will be handled in MERGE? Is by number of records or ALL-In or ALL-Out is case of failure?
Yes, MERGE is a single SQL Statement and is no different to a vanilla INSERT or UPDATE.
Quote:
Just side question, I know Load utility is out of question but just want to make sure I got it right. DB2 Load utility will handle only bulk INSERTs but for Update I have to use UPDATE command. Is my understanding correct?

Rwe
That's correct.
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On