February 20, 2009

Country / State / Province Lookup Tables for SQL server

Filed under: SQL Server — Tags: , , , — Darrin Maidlow @ 5:50 pm

**Update 2011.12.09 – I’ve posted an

Every time I build a contact form/database I hit this problem.  I need a set of tables for Country, State/Province lookup.  “But, that’s like 60 records and I don’t wanna type out every state and province!”.

Every time, I hit the Google looking for SQL scripts – and I can’t seem to find anything, or I find that one script for mySQL.  The last time I did this, I created a set of SQL scripts and I saved them.  I forgot that I saved them – and made another SQL script.  Doh. 

This time when I was working on the new contact form for this site, I decided to write this blog post in hopes that the next time I need to do this – when I search Google my blog might come up and remind me not to re-invent the wheel.  So I’ve included a zip with the SQL script here.  This script is for SQL server 2005 – but will translate over to Oracle very easily.

If you find any problems with the script, or feel like adding more countries, feel free to pass those changes along to me!


  1. Thanks Alot

    Comment by Marwan — June 19, 2011 @ 5:33 am

  2. thanks

    Varun Maggo

    Comment by Varun Maggo — July 14, 2011 @ 7:07 am

  3. [...] for Country / State-Province lookup tables for Oracle!   Building on my earlier post on Country / State Lookup Tables for SQL Server I’ve built a new script for Oracle.  This script will create two tables, two sequences for [...]

    Pingback by Country / State Lookup Tables for Oracle « Geospecialling — December 9, 2011 @ 3:10 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress

Switch to our mobile site