MarkEmerson
Programmer
Hello Again,
Next problem, I want to compare a list of codes in one table(tblA) to a list of codes in another table(tblB). Any codes that are in tblB but NOT in tblA should be written to tblC.
---------------------------
INSERT tblC
select Code
from tblA
where not exists
(select *
from tblB
where Code = tblB.Code)
order by Code
Go
----------------------------
When I execute this code it copies all records across even though there are some that shouldnt be copied. Why is this and how do I fix it?
both Code fields in tblA and tblC are varChar(7)
Thanks again, Mark
Next problem, I want to compare a list of codes in one table(tblA) to a list of codes in another table(tblB). Any codes that are in tblB but NOT in tblA should be written to tblC.
---------------------------
INSERT tblC
select Code
from tblA
where not exists
(select *
from tblB
where Code = tblB.Code)
order by Code
Go
----------------------------
When I execute this code it copies all records across even though there are some that shouldnt be copied. Why is this and how do I fix it?
both Code fields in tblA and tblC are varChar(7)
Thanks again, Mark