Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2011
    Posts
    1

    Unanswered: need dynamic sql scripts

    Hi Guys,

    I am new in dynamic sql and I do not have a good tutorial to read. I wanted create two dynamic sql queries.

    table -1

    1. Script name - test_Fix.sql
    2. Copy the original “&1..test” table to “&1.. test _<sysdate, including time >.
    3. Then recreate the “&1..test” table with a CTAS reading from the “&1.. CONTACT _<sysdate> table.
    4. While creating the “&1..test” table, drop records from the table that have - “where trim(first_name) is null and trim(last_name) is null”.


    teble 2


    First table:
    1. Script name – test2 _Fix.sql
    2. Copy the original “&1..test2” table to “&1..test2 _<sysdate, including time>.
    3. Then recreate the “&1..test2” table with a CTAS reading from the “&1..test2 _<sysdate> table.
    4. While creating the “&1..test2 ” table, if answer_date is equal to “10/16/2209” change it to “10/16/2009”

    I will really appreciate if some one can help me with dynamic sql query.

    Thank you,
    Freebee

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11

    dyn sql

    have a look at IBM DB2 9.7 for Linux, UNIX and Windows Information Center
    and check for create table .. to copy table or
    insert .. select to transfer data
    and delete from table where col1 is (not) null
    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

Tags for this Thread

Posting Permissions

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