Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2008
    Posts
    7

    Unanswered: 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.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    have you tried the get diagnostics command
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

  3. #3
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Try also
    Code:
    select count(1) from new table (insert whatever into yourtable) t
    and similarly for updates.
    ---
    "It does not work" is not a valid problem statement.

  4. #4
    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

  5. #5
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

  6. #6
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •