insert rows into single table from two table which has different columns
-
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert. so plz provide solution
-
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert. so plz provide solution
Here is a sample. have done this using SQL Server but it shouldn't be hard to move it too one of the other databases
create table #tableOne
(
id int,
name varchar(50),
email varchar(100)
)create table #tableNames
(
id int,
name varchar(50)
)insert into #tableOne values (1, 'simon','simon@email.com')
insert into #tableOne values (2, 'someone','someone@email.com')insert into #tableNames values (3, 'fred')
insert into #tableOne
select id, name,''
from #tablenamesselect *
from #tableOnedrop table #tableNames
drop table #tableOneEvery day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON
-
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert. so plz provide solution
-
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert. so plz provide solution
INSERT INTO b (field list b) SELECT field list a FROM a
-
i have two tables a and b.a has 7 different columns and b has 20 different columns. i want to insert rows from a to b.how to insert. so plz provide solution
Specify Columns Of Table B. Like Insert Into B (Col1,Col2,Col3) Select Col9,Col8,Col7 From A. Please Note That Data Type of Column Should Be Same.