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 > How to create .scr file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-07, 16:02
venkatkrp venkatkrp is offline
Registered User
 
Join Date: Oct 2007
Posts: 9
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
Reply With Quote
  #2 (permalink)  
Old 12-03-07, 16:16
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
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
Reply With Quote
  #3 (permalink)  
Old 12-03-07, 16:22
venkatkrp venkatkrp is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 12-03-07, 16:37
venkatkrp venkatkrp is offline
Registered User
 
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
Reply With Quote
Reply

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