By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,610 Members | 2,332 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,610 IT Pros & Developers. It's quick & easy.

How do you kick off a DB2 Script in AIX ?

P: 1
I'm new to using DB2 from AIX, and need to run a series of EXPORT commands of the form EXPORT TO /dir/file1.txt OF DEL MESSAGES /dir/file1.msg SELECT * FROM <TABLE> WHERE <CLAUSE>

I would like to be able to create a single script that houses all the EXPORT commands and then invoke DB2 from the command line to run these one after then other.

Can anyone help me with how this is done ?

Thanks,

Prem Isaac
Sep 25 '07 #1
Share this Question
Share on Google+
2 Replies


P: 14
CONNECT TO <dbname>user <userid> using <'password'>;
EXPORT TO /dir/file1.txt OF DEL MESSAGES /dir/file1.msg SELECT * FROM <TABLE> WHERE <CLAUSE>;
<next export command>
..
.
.
.
.
.
commit;
CONNECT RESET;
Sep 26 '07 #2

docdiesel
Expert 100+
P: 297
Hi,

or use a shell script:
Expand|Select|Wrap|Line Numbers
  1. db2 connect to mydb
  2. for var_mytable in "table1 table2 table3"
  3. do
  4.   db2 "export to ${var_mytable}.txt of del  select * from myschema.${var_mytable} ..."
  5. done
  6. db2 connect reset
  7.  
Regards, Bernd
Sep 27 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.