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

Insert values into a table B based on a flag on table A

P: 1
I am totally new to db2 scripting.

I have a doubt. Please help
We have DB2 on our AIX machine. I have two tables (A and B). Table A has a column 'ACTIVE'. There are like 200 rows of data in this Table A. If column 'ACTIVE' =true, then i have to insert few rows of 'Table A' and some other constants in 'Table B'.

Can anyone please provide some sample code to do this.

Appreiciate your help in advance.

Thanks
Sam
Aug 8 '07 #1
Share this Question
Share on Google+
3 Replies


P: 17
Insert into tableb (select col1, col2 from tablea where column = 'active');
Aug 8 '07 #2

Motoma
Expert 2.5K+
P: 3,235
Insert into tableb (select col1, col2 from tablea where column = 'active');
Thanks for the help Hevan!
Aug 9 '07 #3

10K+
P: 13,264
Insert into tableb (select col1, col2 from tablea where column = 'active');
I rather think they were looking for

Expand|Select|Wrap|Line Numbers
  1. Insert into tableb (select col1, col2  from tablea where active = true);
Aug 10 '07 #4

Post your reply

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