sqlagent007
asked on
copy table1 and create table2, query table1 for changes and add them to table2
I am copying data from table1 to create table2. I would like to create table2, do testing then append current data from table1 into table2.
Can anyone help me write a query that takes all data from table1 that is not in table2 and inserts the data in table2?
Thanks,
Can anyone help me write a query that takes all data from table1 that is not in table2 and inserts the data in table2?
Thanks,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
u can use DTS to trnsfer the data, which will be very useful and gives knowledge in DTS
You can do this with or without DTS. Its not really needed.
Using DaveSlash example,
insert into employee2
select * from employee
minus
select * from employee2;
insert into employee2
select * from employee
minus
select * from employee2;
insert into employee2
select * from employee
minus
select * from employee2;
That won't work if this is SQL Server...not sure what platform this is.....MINUS does not exist in T-SQL
Select *
from table1 as one left outer join table2 as two
on one.id = two.id
where two.id is null