I need to move data from Intel_Data table into Intel_MainDataTable table into sql Server. I have following query
INSERT INTO Intel_MainDataTable SELECT * FROM Intel_Data WHERE Intel_MainDataTable.id != Intel_Data.id
But this code gives errors, it says that Intel_MainDataTable.id donn't exists. Both Tables have same fields. They are identical. Who can help me to write correct this query ?
select into
SELECT * INTO Intel_MainDataTable FROM Intel_Data Intel_MainDataTable;
INSERT INTO newtable SELECT * FROM oldtable WHERE oldtable.id not in (select id from newtable)
INSERT INTO newtable SELECT * FROM oldtable WHERE NOT EXISTS (SELECT * from newtable where id=oldtable.id);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)