• Your shopping cart is empty!

How to import UTF-8 data into Microsoft SQL Server 2008

This step-by-step guide involves the use of the SQL Server Import And Export Wizard. You should have already created the table for the data using the SQL codes provided in the product pages.

 

Select the source from which to copy data

Run the SQL Server Import And Export Wizard. Press Next until you see the Choose a Data Source page. In the Data Source dropdownlist, select Flat File Source. Then press Browse and select the data file. In the Code page dropdownlist, select 65001 (UTF-8). You must select this code page otherwise your data will be corrupted. The rest of the settings should look like the image below.
Import UTF-8 data into Microsoft SQL Server 2008

 

Next, click on the Advanced section on the left side of the page. You will now see a list of columns. Now change the DataType of each column to Unicode string like in the image below:
Import UTF-8 data into Microsoft SQL Server 2008

 

If the length of the column is longer than 50 characters then you will have to modify the OutputColumnWidth like in the image below:
Import UTF-8 data into Microsoft SQL Server 2008

 

Choose where to copy the data to

Press Next and you will see the Choose a destination page. Here you select your SQL Server installation, key in the username / password and select the database. Press Next and you will see the Select Source Tables and Views page. Here you must modify the destination to a table name that does NOT exist yet. The import process will then create this table for you. In my example, it is called temporary_table. Do not press the Edit Mappings button. The page should now look like the image below:
Import UTF-8 data into Microsoft SQL Server 2008

 

Doing the copying and cleaning up

Now just keep pressing Next until you reach the end. When the data has been successfully inserted into the temporary_table table, you should see something like the image below:
Import UTF-8 data into Microsoft SQL Server 2008

 

Next, you can close the wizard and open up the SQL Server Management Studio. Connect to your SQL Server instance. Then click on New Query. Make sure you have selected the correct database. Run the code that you see in the image below (You may have to change the table names to fit whatever names you are using):
Import UTF-8 data into Microsoft SQL Server 2008

 

The data will now be transferred from the temporary_table into the actual data table. Once the transfer of data has been completed, delete the temporary_table table. Now your data is ready for use.