Friday, August 22, 2008

SQL Country List

I was looking today to create a lookup table in SQL Server to hold a list of countries.

The following SQL script will create a table in SQL Server and populate it with country values:


CREATE TABLE [tblCountryLookup] (
[country_id] [smallint] IDENTITY (1, 1) NOT NULL ,
[country_desc] [varchar] (250) COLLATE Latin1_General_CI_AS NOT NULL ,
[country_active] [bit] NOT NULL ,
CONSTRAINT [PK_tblCountryLookup] PRIMARY KEY CLUSTERED
(
[country_id]
) ON [PRIMARY]
) ON [PRIMARY]
GO
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Afghanistan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Albania',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Algeria',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Andorra',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Angola',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Anguilla',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Antarctica',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Antigua and Barbuda',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Argentina',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Armenia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Aruba',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ascension Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Australia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Austria',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Azerbaijan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bahamas',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bahrain',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bangladesh',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Barbados',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Belarus',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Belgium',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Belize',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Benin',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bermuda',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bhutan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bolivia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bophuthatswana',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bosnia-Herzegovina',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Botswana',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bouvet Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Brazil',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('British Indian Ocean',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('British Virgin Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Brunei Darussalam',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Bulgaria',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Burkina Faso',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Burundi',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cambodia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cameroon',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Canada',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cape Verde Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cayman Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Central Africa',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Chad',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Channel Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Chile',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('China, Peoples Republic',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Christmas Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cocos (Keeling) Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Colombia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Comoros Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Congo',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cook Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Costa Rica',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Croatia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cuba',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Cyprus',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Czech Republic',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Denmark',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Djibouti',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Dominica',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Dominican Republic',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Easter Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ecuador',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Egypt',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('El Salvador',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('England',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Equatorial Guinea',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Estonia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ethiopia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Falkland Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Faeroe Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Fiji',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Finland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('France',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('French Guyana',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('French Polynesia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Gabon',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Gambia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Georgia Republic',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Germany',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Gibraltar',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Greece',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Greenland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Grenada',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guadeloupe (French)',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guatemala',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guernsey Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guinea Bissau',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guinea',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Guyana',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Haiti',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Heard and McDonald Isls',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Honduras',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Hong Kong',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Hungary',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Iceland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('India',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Iran',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Iraq',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ireland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Isle of Man',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Israel',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Italy',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ivory Coast',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Jamaica',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Japan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Jersey Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Jordan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Kazakhstan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Kenya',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Kiribati',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Kuwait',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Laos',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Latvia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Lebanon',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Lesotho',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Liberia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Libya',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Liechtenstein',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Lithuania',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Luxembourg',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Macao',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Macedonia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Madagascar',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Malawi',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Malaysia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Maldives',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mali',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Malta',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Martinique (French)',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mauritania',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mauritius',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mayotte',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mexico',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Micronesia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Moldavia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Monaco',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mongolia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Montenegro',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Montserrat',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Morocco',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Mozambique',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Myanmar',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Namibia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Nauru',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Nepal',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Netherlands Antilles',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Netherlands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('New Caledonia (French)',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('New Zealand',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Nicaragua',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Niger',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Niue',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Norfolk Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('North Korea',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Northern Ireland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Norway',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Oman',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Pakistan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Panama',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Papua New Guinea',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Paraguay',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Peru',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Philippines',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Pitcairn Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Poland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Polynesia (French)',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Portugal',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Qatar',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Reunion Island',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Romania',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Russia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Rwanda',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('S.Georgia Sandwich Isls',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Sao Tome, Principe',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('San Marino',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Saudi Arabia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Scotland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Senegal',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Serbia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Seychelles',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Shetland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Sierra Leone',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Singapore',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Slovak Republic',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Slovenia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Solomon Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Somalia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('South Africa',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('South Korea',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Spain',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Sri Lanka',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Helena',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Lucia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Pierre Miquelon',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Martins',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Kitts Nevis Anguilla',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('St. Vincent Grenadines',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Sudan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Suriname',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Svalbard Jan Mayen',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Swaziland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Sweden',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Switzerland',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Syria',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tajikistan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Taiwan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tahiti',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tanzania',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Thailand',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Togo',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tokelau',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tonga',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Trinidad and Tobago',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tunisia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Turkmenistan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Turks and Caicos Isls',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Tuvalu',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Uganda',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Ukraine',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('United Arab Emirates',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('United States',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Uruguay',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Uzbekistan',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Vanuatu',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Vatican City State',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Venezuela',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Vietnam',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Virgin Islands (Brit)',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Wales',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Wallis Futuna Islands',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Western Sahara',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Western Samoa',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Yemen',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Yugoslavia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Zaire',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Zambia',1);
INSERT INTO tblCountryLookup(country_desc,country_active) VALUES ('Zimbabwe',1);