I am trying to insert about 90,000 records from a table into another table with the following query:
insert into areacode(area_code, area_county, area_town, area_dep_locality,
area_locality, area_dep_street, area_street, area_la_name, area_easting, area_northing)
select acode3005.area_code, acode3005.area_county, acode3005.area_town,
acode3005.area_dep_locality, acode3005.area_locality, acode3005.area_dep_street,
acode3005.area_street, acode3005.area_la_name, acode3005.area_easting, acode3005.area_northing
from acode3005 left outer join areacode
on acode3005.area_code = areacode.area_code
I am always getting the following error:
Server: Msg 2601, Level 14, State 3, Line 1
Cannot insert duplicate key row in object 'AreaCode' with unique index 'XIE1AreaCode_AreaCode'.
The statement has been terminated.
I have previously run a query on the acode3005 table to delete any records that existed (in terms of the area_code field) in areacode, the error suggests to me that I have not deleted all the matching records.
insert into areacode(area_code, area_county, area_town, area_dep_locality,
area_locality, area_dep_street, area_street, area_la_name, area_easting, area_northing)
select acode3005.area_code, acode3005.area_county, acode3005.area_town,
acode3005.area_dep_locality, acode3005.area_locality, acode3005.area_dep_street,
acode3005.area_street, acode3005.area_la_name, acode3005.area_easting, acode3005.area_northing
from acode3005 left outer join areacode
on acode3005.area_code = areacode.area_code
I am always getting the following error:
Server: Msg 2601, Level 14, State 3, Line 1
Cannot insert duplicate key row in object 'AreaCode' with unique index 'XIE1AreaCode_AreaCode'.
The statement has been terminated.
I have previously run a query on the acode3005 table to delete any records that existed (in terms of the area_code field) in areacode, the error suggests to me that I have not deleted all the matching records.