Thursday, March 5, 2009

Importing lists to MSSQL2008

I had to import a list of country names to an SQL table using MSSQL 2008. I found a list in CVS format here:

http://tobiasconradi.com/geography/

Good, MSSQL 2008 can import from CVS. I set the language codes, delimiters, headers, even the column lengths, and… the import failed. I tried to parse CVS with different setting, but I was unable to execute the task without errors.

Finally I tried Excel 2007. I opened the CVS file with Excel, but character encoding wasn’t right. So I found the Data tab and the From text button. It’s a very convenient and fast way to import CVS. I managed to import the whole CVS file to Excel and I imported the list with the Excel file provider. Now I have beautiful list of countries in numerous languages.

You can download the country list script for SQL Server 2008. It contains two views for English and Hungarian country names.

Link: Country list (.sql)

No comments:

Post a Comment