I have a database that has a list of zip codes which has latitude, longitude, state, city, state fips code, time zone, etc. I'd like to extend this and write either a C# function or TSQL (SQL Server 2008) function that will take a street, city, state and zip and return the zip+4. I've searched high and low and there's many programs out there that can do it but none appear to actually allow me to see what they've done and enhance it for my own needs. Does anyone know of an open source solution that can do this or point me in the right direction so I can make an open source version?
Possibly the easiest solution to use is the USPS's address API (http://www.usps.com/webtools/htm/Address-Information.htm#_Toc131231396) The usage regarding scrubbing databases is a bit vague (and if you ask them about it, it seems they remain just as vague, perhaps on purpose) but once you get approved it's VERY easy to send the data you have and get back a fully verified, 100% compliant and up-to-date address. Once you get the data back from USPS, you can simply add/subtract/agument it as you need prior to stuffing back into the DB. For instance, you could Geocode from the verified address, or from your DB, then append that data into the data you received, inserting in a loop.
I'm using it on one of my applications to validate inbound inquiries and it has proven nearly 100% reliable for getting me what I need corrected.