Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2007
    Posts
    9

    Unanswered: How to create .scr file

    Hi experts

    I am Newbie to DB2.

    I have to creat script which has to import using query (some join query) in DB2

    For ex :
    table A (id integer, type character (10) ,name character (40))

    I want to insert to this table using a query
    -----------------------------
    insert into tableA
    select id, type, name from tableb, tablec
    where tablea.id = tablec.id
    -----------------------------

    Can any one help me on this..?





    Thanks in advance

    S.V

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    Just run your statement as you have written it - it's simple SQL (not even DB2-specific). You only have to make sure that the subselect is valid, i.e. that all columns can be identified uniquely and that the number of columns (and their data types) match the columns of the target table.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Oct 2007
    Posts
    9
    Quote Originally Posted by stolze
    Just run your statement as you have written it - it's simple SQL (not even DB2-specific). You only have to make sure that the subselect is valid, i.e. that all columns can be identified uniquely and that the number of columns (and their data types) match the columns of the target table.

    Thanks lot...

    I forgot say onething.. i have to save this query as .scr file and i have to run this .scr using .ksh file...

    "As you said i will ensure all the stuffs in SQL query.. thanks for your input"

    I need complete .scr file..

    Thanks once again

    venkat

  4. #4
    Join Date
    Oct 2007
    Posts
    9
    i am tring to create .scr file like

    ##################################################
    # Load table TFW00A from DB2 file.
    #################################################

    CONNECT TO TDB2 ;

    su - $instname -c "db2 connect to $dbname" >> /db2/scripts/dba/sp_obj.msg

    su - $instname -c "db2 -txf /db2/scripts/dba/sp_obj.sql" >

    CONNECT RESET;


    Ist step is to create log file
    2nd step to execute the SQL stmt

    Please help.. how to do that

Posting Permissions

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