How can i export MS SQL into MySql table? - mysql

How can i export large tables from MS SQL into MySql table. Please note that the tables a large and.
I tried the mysql migration toolkit that is in MySql Workbench but i could not establish connectons to the SQL server
Please advise me on the best way to do this?
Thanks :)

One method of doing it (if it really is a lot of data and a lot of tables): creating a linked server in SQL Server and using it to push data into MySQL.
This article gives step-by-step instructions to create the linked server.
ANd then just run queries against your tables like so:
INSERT INTO OPENQUERY (<LINKED SERVER>, 'SELECT * FROM MySQL_Table')
SELECT * FROM dbo.SQL_Table

Related

Join queries from two different databases on the different server

Can i use mySql and SQL Server DB combine, I have a stored procedure in sql server DB and i like to add another table to that procedure but that table is in mySql DB on a different server, is there some way to use two different DBs like this.
Please help. Thanks in advance.
You have to create a Linked Server in MSSQL, pointing to your MySQL server. In order to do that, you can follow the tutorial here.

Pulling Data from MySql and dropping it into SQL

I was wondering if anybody had any advice or references that explain how to pull data from MySQL and drop it into SQLSever! Any input would be greatly appreciated!! Thanks!
You can add MySQL as a "linked server"
http://forums.mysql.com/read.php?60,123221,123221
Once you did that you can reference the MySQL tables, views, etc with their fully qualified name in regular SQL Server queries
I could not tell if you wanted to access a MySQL database because you were migrating to SQL server, or if you wanted to access a MySQL database on an ongoing basis. I am answering as if you want to migrate, because you already have an excellent answer on accessing MySQL from SQL Server.
If you want to migrate, mysqldump is one way to go. Its format is easily parsed.
You can also write the results of any MySQL table -- and SQL Server for that matter -- to .csv format. .csv format is nearly a universal transfer format for data.

MySQL trigger to update SQL Server table

Is it possible to update a table in SQL Server using a trigger in MySQL. The scenario is like this.
When a table is updated in MySQL, a corresponding update is to be done in SQL Server for the purpose of syncing certain fields. I understand that the reverse is possible using a linked server in SQL Server.
You can write a UDF function that would update data in the SQL Server. Then call this UDF from the trigger.
Here's some information which may be of help regarding linking SQL Server and MySQL
http://forums.mysql.com/read.php?60,123221,123221
I'm afraid I've no personal experience in the matter as I thankfully have MySQL servers across the board, however had a scan through the links in the above and at least one of them should be able to assist.

MySQL to SQL Server migration

I have a mysql database full of data which I need to keep but migrate to SQL Server 2008.
I know end to end where the data should go, table to table but I have no idea how to go about moving the data. I've looked around the web but it seems there are 'solutions' which you have to download and run. I'd rather if possible do something myself in terms of writing scripts or code.
Can anyone recommend the best way to do this please?
You have several options here:
On the sql server side, you can set up a connection to your old mysql db using something called a linked server. This will allow you to write sql code for sql server that returns data from the mysql tables. You can use this to build INSERT or SELECT INTO statements.
You can write queries for mysql to export your data as csv, and then use the BULK INSERT features of sql server to efficiently import the csv data.
You can use Sql Server integration services to set move the data over from mysql.
Regardless of which you choose, non-data artifacts like indexes, foreign keys, triggers, stored procedures, and security will have to be moved manually.
Have you tried tool from MSFT called SQL Server Migration Assistance for MySQL ???
https://www.microsoft.com/download/en/details.aspx?id=1495
Try this tutorial it is very easy to perform migration to SQL Server from Mysql and is straightforward as mentioned
http://www.codeproject.com/Articles/29106/Migrate-MySQL-to-Microsoft-SQL-Server
Thanks
You can use the Import/Export Wizard that comes with SQL Server Standard Edition.
Select your 'data source' from MySQL using the ODBC data source. Note: You will need to first install the from ODBC driver for MySQL (ODBC Connector). Then, select your SQL Server destination. Select all tables, and fire it up. You will need to add your primary and foreign keys, and indexes manually.
A bit more automated means would be by using the SQL Server Migration Assistant for MySQL, also free. It has the benefit of recreating the relationships and indexes automatically for you. Probably your best bet.
I did it once, some time ago. First you could couple your mssql server to the mysql server using the odbc mysql connector
http://dev.mysql.com/downloads/connector/
After the connection is made you can write you database procedure as you would if it were two mssql db's. Probably easiest to write some sql batch scripts including a cursor where you run through every every row of a table an decide on a field basis where you will need the field in the future.
example of a cursor: http://www.mssqltips.com/tip.asp?tip=1599
If you decide to go with the cursor, you can play with the parameter to increase performance. I especially remember the FORWARD_ONLY parameter giving a big boost.

Linked tables in SQL server 2008 express

I am migrating an ACCESS 2000 to SQL express 2008 and am having trouble with the linked tables. Is there a way to replicate the ACCESS linked tables to SQL?
Thank you
You can use the upsizing wizard or the Microsoft SQL Server Migration Assistant 2008 for Access. Once you have the tables on your SQL server you can then link them using either the normal table linking method or through code if you want to be fancy
EDIT:
If they are on the same physical box then one way is to make views of the table using the full 3 name. In the below example I’m creating a view in the database Tracker_3 that is looking at the table tblStaff_details in the database Skyline_common
USE [Tracker_3]
GO
create view [dbo].[tblStaff_details]
as
select * from Skyline_common.dbo.[tblStaff_details]
GO
What I want to do is link a database from SQL express (Database db1, Table tbl1) to SQL express (Database db2, Table tbl2)... How can I do this?
Uh, if db1 and db2 are the names of the databases on the same server, it is quite easy to query between different databases.
select *
from db1.dbo.tbl1 inner join db2.dbo.tbl2
on tbl1.employeeid = tbl2.managerid
Hope that helps.