DB2 - L

  • 1.  how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 23, 2021 10:31 AM
    I have some 110 QMF queries I need to copy from one userid to another userid.
    Is there a way I can "batch" this rather than export and import each one at a time?
    thanks
    Bill

    ------------------------------
    williamgiannelliMe
    ------------------------------


  • 2.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 23, 2021 11:31 AM

    William,

     

    I haven't done that before but EXPORT (QUERY or FORM) and IMPORT can both be invoked in a PROC. 

     

    It should be manageable to do something like putting the objects in a string processor (say, Excel) and then concatenating the language for the Exports and file creates; then cut and paste into a QMF batch job which creates the proc and executes it, one for the source, one for the target.

     

     

    Philip Sevetson

    Computer Systems Manager

    FISA-OPA

    5 Manhattan West

    New York, NY 10001

    psevetson@fisa-opa.nyc.gov

    917-991-7052 m

    212-857-1659 f

    image001.png@01D261E4.BE68E970

     






  • 3.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 23, 2021 12:46 PM

    The queries, forms, etc in QMF are kept in tables. You could use an insert of the type:

    insert into q.query
    select new_user_id, all other columns from table
    where user = old_user_id



    David Nance








  • 4.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 23, 2021 12:50 PM
    QMF-Queries are stored in normal Db2-tables: Q.OBJECT.DIRECTORY, Q.OBJECT.DATA and Q.REMARKS ( I hope I remember the james correctly). So you can simple run 3 insert-statements like:
    INSERT INTO Q.OBJECT.DIRECTORY
    SELECT new userid, all the other columns
    FROM Q.OBJECT.DIRECTORY
    WHERE USERID = userid to copy from
    (I am not sure if the column-name is right)
    and 2 further inserts

    ------------------------------
    WalterJanißenRetired
    ------------------------------



  • 5.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 23, 2021 01:16 PM
    Thank you!
    Yes, I found a section in the doc for transferring ownership by updating the table data............

    ------------------------------
    williamgiannelliMe
    ------------------------------



  • 6.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 30, 2021 08:55 AM
    I have been trying updates and inserts and am getting :
    SQLCODE = -803, ERROR: AN INSERTED OR UPDATED VALUE IS INVALID BECAUSE INDEX IN
    COLUMNS OF THE TABLE SO NO TWO ROWS CAN CONTAIN DUPLICATE VALUES IN THOSE COLUMN

    ------------------------------
    williamgiannelliMe
    ------------------------------



  • 7.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 30, 2021 04:21 PM
    I am not sure what you want to achieve. Your original question was how to copy objects. Why did you run updates?

    ------------------------------
    WalterJanißenRetired
    ------------------------------



  • 8.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Sep 30, 2021 04:34 PM
    sorry, my bad.
    anyway the inserts were failing because some queries already existed under the new id............

    ------------------------------
    williamgiannelliMe
    ------------------------------



  • 9.  RE: how to copy many QMF queries, procs, etc from on user to another

    Posted Oct 01, 2021 01:23 PM
    Ok, that is of course possible, but also the name is the same, the content could be completely different.

    ------------------------------
    WalterJanißenRetired
    ------------------------------