Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Easiest way to import data from My Sql to Sql Server

For a new project I have to import the pre-existing data from MySql.

In this site I have found many options, some including the installation of drivers. What is the fastest & easiest way to do it?

Update: this would be just a one time import

like image 740
Santiago Corredoira Avatar asked Nov 20 '08 16:11

Santiago Corredoira


2 Answers

-- Create Link Server

EXEC master.dbo.sp_addlinkedserver 
@server = N'MYSQL', 
@srvproduct=N'MySQL', 
@provider=N'MSDASQL', 
@provstr=N'DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost; _
     DATABASE=tigerdb; USER=root; PASSWORD=hejsan; OPTION=3'

-- Import Data

SELECT * INTO testMySQL.dbo.shoutbox
FROM openquery(MYSQL, 'SELECT * FROM tigerdb.shoutbox')
like image 102
Abdul HaSeeB Avatar answered Oct 30 '22 04:10

Abdul HaSeeB


To convert MySQL to MS SQL Server database you can use Microsoft SQL Server Database Migration Assistant

like image 36
marcin.golebiowski Avatar answered Oct 30 '22 04:10

marcin.golebiowski