Mike Irving - Macclesfield Web Developer

Import MySQL Website Data into Microsoft SQL Server 2005

Mike Irving - Macclesfield Web Developer image 1 Mike Irving - Macclesfield Web Developer image 2

News Section - Import MySQL Website Data into Microsoft SQL Server 2005

Developer Blog from Mike Irving - Import MySQL Website Data into Microsoft SQL Server 2005

31/1/2009 - Import MySQL Website Data into Microsoft SQL Server 2005

Recently I have been working on a new shopping website, written in C# and SQL Server, that was to replace on old website that had been written in Perl, with a MySQL database.

The new website bears little resemblance to the old site, in terms of design, code or data. However, there was some old data in the MySQL Database that we wanted to retain access to.

In order to use the data in SQL Server 2005, or indeed in the Visual Studio 2008 / ASP.Net 3.5 project, I would need to import it from the old MySQL repository.

This process turned out to be very simple indeed, so I though I'd document the process below:

Firstly, you'll need to install the MySQL ODBC Driver on your working machine.
- if you dont have it, you can find it on the MySQL Connectors Download page.

Once installed, open ODBC Data Source Administrator, Add a System DSN to your MySQL Database, using the connector you have just installed.

Next, fire up Microsoft SQL Server Management Studio. Create a new database, or select an existing one you'd like to import data into.

Right click on the database, and select Import Data.

Select the .Net Framework Data Provider for Odbc as your source.

Choose or confirm your Destination table and database.

Next, Write a query to execute against the MySQL database, to specify the data to transfer.

i.e. SELECT * FROM ORDERS;

SQL Server will then attempt to match up MySQL Columns to MSSQL ones, for the data to be imported. If you want to, you can click Edit Mappings, Column Mappings and specify your own Data Column Properties.

The next part is simple, just click Run Immediately.

Within a few seconds, or minutes (depending on the size of your data), all will be complete and your data will be in SQL Server!

Rename the Query Table as appropriate, by default it will be given a generic name, i.e. "Query".

Repeat the process for any other tables you wish to import.

I was very impressed with how simple and quick this process was, and may well be doing such an import again for future projects.


View Blog Entries - Page: 1, 2, 3, 4, 5, 6
Previous Blog Entries
20
Dec
2008
Debugging JavaScript in your Websites, using Visual Studio 2008
This week I have been working on a new website project, using Microsoft Visual Studio 2008 for the first time. If you are coming to Studio 2008 from Studio 2005, everything seems similar, and you s...

Read This Blog Entry
25
Nov
2008
Foreign Language Website Puzzle - Firefox, CSS and File Encoding
I had an interesting problem to solve the other week when looking over a website page that had been translated to Russian, and was delivered from a machine hosted in Russia. The translation was fin...

Read This Blog Entry
19
Oct
2008
New Website for Andy Till
This week I have delivered a completely redesigned website for Andy Till. Andy is a Personal Friend, Professional Bass Player, and star of the new 2008 Hovis Adverts! The old site had been onlin...

Read This Blog Entry
View All Blog Entries

Mike Irving (mikeirvingweb) on Twitter
My latest Tweet on Twitter...

Follow Me on Twitter

Bookmark this web page:
© 2010 Mike Irving Web Design Macclesfield