| Author |
Topic |
|
gsrinivas.
Yak Posting Veteran
56 Posts |
Posted - 2008-10-25 : 03:42:07
|
| hi,How can i append a table to another same structured table.(for example, create table numbers(i int) go insert numbers (i) values(1) insert numbers (i) values(2) insert numbers (i) values(3) insert numbers (i) values(4) go select * from numbersNow i want to create another table with same structure.. create table numbers2(i int) go insert numbers2 (i) values(5) insert numbers2 (i) values(6) insert numbers2 (i) values(7) insert numbers2 (i) values(8) go select * from numbers2========================================now my requirement is appending (numbers2) table to (numbers) tableafter executing the required query ,the numbers (first table) tablecontains numbers from 1 to 8 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-25 : 03:53:58
|
| insert into numbersselect * from numbers2 |
 |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2008-10-25 : 04:23:19
|
| select * into numbers from numbers2malay |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-25 : 04:26:20
|
quote: Originally posted by malaytech2008 select * into numbers from numbers2malay
nope. this will throw error as table already exists. The reqmnt is 'append to an already existing table' |
 |
|
|
gsrinivas.
Yak Posting Veteran
56 Posts |
Posted - 2008-10-25 : 08:13:58
|
| is it working..select * into numbers from numbers2i think the error message may be occurs..."numbers" already existed....okok... i can check it at home..thanks for reply... |
 |
|
|
gsrinivas.
Yak Posting Veteran
56 Posts |
Posted - 2008-10-25 : 08:14:24
|
| is it working..select * into numbers from numbers2i think the error message may be occurs..."numbers" already existed....okok... i can check it at home..thanks for reply... |
 |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2008-10-25 : 08:45:19
|
| thanks to u..mistakes in recognizing tables ->>correct one select * into numbers2 from numbersmalay |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-25 : 09:14:01
|
quote: Originally posted by malaytech2008 thanks to u..mistakes in recognizing tables ->>correct one select * into numbers2 from numbersmalay
you missed my point. what i told was as numbers2 already exists it will throw error. If you look at OPs post what it suggests is he has two tables table1 (with rows 1 to 4) and table2(with rows 5 to 8) and reqmnt was to append records of table2 to table1 so that it contains records 1-8. Your query tries to create numbers2 table which already exists that why error. for appending numbers2 to numbers what you should be doing isinsert into numbersselect * from numbers2 which add rows 5-8 to numbers table so that it will contain 1-8 rows. |
 |
|
|
gsrinivas.
Yak Posting Veteran
56 Posts |
Posted - 2008-10-26 : 04:02:57
|
| hai visakh!thank you for reply.its working fine .actually my idea is same as yours.but what wrong is...insert into first_table values select * from second_table._______________________-------____________________________yaya.. my misatke is just "values"any how thank you.and i will post another doubt. |
 |
|
|
malaytech2008
Yak Posting Veteran
95 Posts |
Posted - 2008-10-26 : 06:00:42
|
| thanks visakh.malay |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-26 : 06:57:01
|
quote: Originally posted by gsrinivas. hai visakh!thank you for reply.its working fine .actually my idea is same as yours.but what wrong is...insert into first_table values select * from second_table._______________________-------____________________________yaya.. my misatke is just "values"any how thank you.and i will post another doubt.
no worries you're welcome |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-26 : 06:59:38
|
quote: Originally posted by malaytech2008 thanks visakh.malay
welcome |
 |
|
|
|