help with a conditional INSERT statement
I have a zip code table which I downloaded from a website in Excel format. I need help on an INSERT script which will look at the Excel table (Imported into Access) and INSERT the row from the Excel table into local Zip Code table unless the entry already exists in the Local table.
Would it be something like "INSERT INTO ZipCodes (zip,city,state,area_code) VALUES (excel.zip,excel.city,excel.state,excel.area_code) IN excel;'?
if I set the Primary Key to zip, then it should ignore the entries that already exist right?
Sounds reasonable. I don't know, however, what exactly Access will do if you try to insert a duplicate key: just ignore it or raise an error.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)