PopularData.com provides a free list of U.S. ZIP codes in CSV format on their Web site. I have taken the liberty of using that data to generate a SQL script that will create a [ZipCode] table in your SQL Server 2005 database and populate it with over 42k unique U.S. ZIP codes. Schema details can be found on this page.
I have uploaded the SQL script to a new BitBucket repository: ZipCode database in SQL
Back in 2005, I wrote an article for CodeProject that describes how to use ZIP codes to find locations within a given radius from a central point. I plan to update that code and host it in the BitBucket repository.
For now, I am assuming that if you download this file, you know why you need a ZIP code database and how you should use it. If not, perhaps the above-mentioned CodeProject article can give you a little guidance.
If you find problems with the data, please alert PopularData.com, as they are the keepers of the master list. If you don’t mind, please alert me, too.
If you find problems with the SQL script, please alert me.
I should also note that you get what you pay for. As far as I know, 2001 was the last time this database was updated. If you need assurance of accurate ZIP code data, look for a commercial solution. They exist, and they are not that expensive.
Finally, the ZIP code data belongs to PopularData.com and is governed by whatever license they have in place (none is mentioned on their site, nor in the CSV file). Everything else in the SQL script is governed by the MIT license.