Friday, October 12, 2012

t-sql list of countries

On February 15, 2022 we released easy lookups by xSQL Software https://lookups.xsql.com/ - you can now get the countries list and other commonly used lists for free. You can consume those lists directly as JSON/xml services in your JavaScript apps, or download in one of the following, ready to use formats:
  • JSON
  • XML
  • CSV
  • SQL Server insert statements
  • Oracle insert statements
>>> original article below - links replaced with the new lookup link

The script which you can download from the link below creates a "countries" table and populates it with the complete ISO list including the Numerical Code of the country, the name of the country both in lower case letters and upper case letters, the ISO ALPHA-3 code and the ISO 3166-1-alpha-2 code.
A couple of notes:
  1. the Countries table created by the script does not have a Primary Key defined on it - you will need to define one.
  2. The following territories are listed on the ISO site but they are not listed on the UN site so I did not include them in the script.
UNITED STATES MINOR OUTLYING ISLANDS, UM
TAIWAN, PROVINCE OF CHINA, TW
HEARD ISLAND AND MCDONALD ISLANDS, HM
SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS, GS
VIRGIN ISLANDS, BRITISH, VG
FRENCH SOUTHERN TERRITORIES, TF
CHRISTMAS ISLAND, CX
COCOS (KEELING) ISLANDS, CC
BOUVET ISLAND, BV
ANTARCTICA, AQ

You can download the script from here: https://lookups.xsql.com/

0 comments:

Post a Comment