If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > need dynamic sql scripts

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-27-11, 15:18
freebee freebee is offline
Registered User
 
Join Date: Feb 2011
Posts: 1
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
Reply With Quote
  #2 (permalink)  
Old 03-01-11, 05:21
przytula_guy przytula_guy is offline
Registered User
 
Join Date: Apr 2006
Location: Belgium
Posts: 1,159
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
DB2 UDB LUW Certified V7-V8-V9-V9.7 DB Admin - Dprop..
Information Server Datastage Certified
http://www.infocura.be
Reply With Quote
Reply

Tags
dynamic sql

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On