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 > Task Center Issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-20-08, 04:15
v3nom v3nom is offline
Registered User
 
Join Date: Sep 2008
Posts: 7
Task Center Issue

I am running scheduled tasks in Task center that frequently updates / inserts data from one table to another.

The queries are simple insert /update statements.

I need to know wheter it is possible to know how many rows have been updated / inserted. Currently i only get the following command on insert
DB20000I The SQL command completed successfully.
Reply With Quote
  #2 (permalink)  
Old 09-20-08, 09:19
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
have you tried the get diagnostics command
__________________
Best Regards, Guy Przytula
Database Software Consultant
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
  #3 (permalink)  
Old 09-20-08, 10:07
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Try also
Code:
select count(1) from new table (insert whatever into yourtable) t
and similarly for updates.
Reply With Quote
  #4 (permalink)  
Old 09-20-08, 20:58
v3nom v3nom is offline
Registered User
 
Join Date: Sep 2008
Posts: 7
Quote:
Originally Posted by n_i
Try also
Code:
select count(1) from new table (insert whatever into yourtable) t
and similarly for updates.
This would effectively mean i am running the query twice on the same table.... i guess for this a simple count statement would have also sufficed along with the insert /update following it.... for large table this will be a slow process

Quote:
Originally Posted by przytula_guy
have you tried the get diagnostics command
well i tried this angle.... but i guess you need to store the value of this register somewhere which is not possible in a command editor kind of environment
Reply With Quote
  #5 (permalink)  
Old 09-21-08, 04:26
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by v3nom
This would effectively mean i am running the query twice on the same table
Not at all: a "SELECT from FINAL TABLE" will query the rows being added to the table while doing the INSERT, so no double work at all.

By the way: this "select from insert" syntax also gives you the possibility to find out which were the default values and/or identity column values being inserted.

Example: suppose table1 has columns (ID, NAME), where ID is the PK, an identity column.
Code:
SELECT id FROM FINAL TABLE (INSERT INTO table1(name) VALUES ('Peter') )
would return me the PK of the row that I just inserted; very difficult to find out which it was otherwise!
This clearly does *not* query the base table twice: the SELECT just interrogates the single row inserted into table1, just after the row to be inserted has been fully built up.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
  #6 (permalink)  
Old 09-23-08, 06:42
v3nom v3nom is offline
Registered User
 
Join Date: Sep 2008
Posts: 7
Quote:
Originally Posted by Peter.Vanroose
Not at all: a "SELECT from FINAL TABLE" will query the rows being added to the table while doing the INSERT, so no double work at all.
my mistake.... i did not check the values correctly... it is indeed inserting records as well.... thanks for that....

is there anyway i can log this record into my disk??....my db2 is currently on an AIX setup
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