IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
#Operatingsystems
#Servers
 View Only
  • 1.  Way to setup a default Schema when uploading results from Run SQL Scripts

    Posted 03/10/26 04:10 PM

    I am using the following to run SQL scripts & upload data to an excel. 

    Run SQL Scripts (32-bit) Version: 1.1.9.0  Build id: 2170

    After I run the SQL & the rows are displayed, I right Click on the grid of rows & select "Upload Results..."

    It defaults the Schema to some library I don't care about.

    Is there a way to configure & set a default Schema Name when uploading results from Run SQL Scripts ?

    Is there a way to configure & set a default Table Name when uploading results from Run SQL Scripts ?



    ------------------------------
    Mohan Eashver
    ------------------------------


  • 2.  RE: Way to setup a default Schema when uploading results from Run SQL Scripts

    Posted 03/10/26 04:42 PM

    No, you can't... you can only set default schema's/library lists for the SQL you run itself... not for save/restore result sets.



    ------------------------------
    Paul Nicolay
    Architect
    Cegeka
    ------------------------------



  • 3.  RE: Way to setup a default Schema when uploading results from Run SQL Scripts

    Posted 03/11/26 02:51 AM
    Edited by Satid S 03/11/26 03:11 AM

    Dear Mohan

    >>>> I am using the following to run SQL scripts & upload data to an excel.  <<<<

    I'm afraid you use incorrect word.  Since Excel is in a PC client, you should use the word "download" instead.

    >>>> After I run the SQL & the rows are displayed, I right Click on the grid of rows & select "Upload Results..."  ......   <<<<

    Your question implies that you want to do a SELECT query from a physical file in IBM i and want to store the query's result set into ANOTHER physical file in IBM i. For this purpose, you do NOT need to query it from Run SQL Script session and then upload it back to IBM i which is a wasteful detour way to do it in terms of operational performance and common sense.  Instead, a better way to do this is that you should use the SQL statement CREATE TABLE AS as follows: 

    CREATE OR REPLACE TABLE libx.tablex AS ( your SELECT statement ) WITH DATA ON REPLACE DELETE ROW ;  (If you want to add rows, use PRESERVE instead of DELETE or do not specify ON REPLACE clause at all as PRESERVE is the default mode already for CREATE TABLE AS. )

    You can run the statement above (including testing  "your SELECT statement" before including it into the CREATE TABLE AS) in Run SQL Script session and the hard code ( libx.tablex ) provides an answer to your question about "a way to configure & set a default Schema Name and Table Name" without a need to upload it from ACS.  You would do the manual upload from ACS only when you cannot write "your SELECT statement" that satisfies your row selection criteria but I figure this should be very rare. 

    Please be informed and let me know if you have any further question. 



    ------------------------------
    Satid S
    ------------------------------