mysql select from one server insert to another mysql server? - mysql

I wont to do insert to one mysqll server to and get the data or do the select part
of the insert into select from anther mysql server
not just copy entire tables is this possible in my sql
I know that in MS Sql server you can do a linked server
thanks

The excellent, FOSS, cross-platform SQL Workbench query tool supports exactly this, for any database you have a JDBC driver for, as documented in this manual page.

Related

SSIS linked to a mySQL server

in SQL server it's possible to link a mySQL server into msSQL and query it using SSMS for example. I want to try this and use SSIS to do some transformations and store all the data on this mySQL database.
\I read that there a several ways to link to mySQL into the msSQL server. OLE DB, mySQL ODBC etc etc.
2 questions:
Are there any limitations i might run into when i will use a combination of SSIS and mySQL instead of msSQL?
When i link a mySQL database into msSQL and i write a query in SSMS, do i write the queries in mySQL language or msSQL language. For example the difference in TOP and LIMIT
I have worked with a linked MySQL Server from SQL Server in the past and ran into some issues.
Querying MySQL from SSMS (SQL Server)
Once you have created a linked server you would imagine you should be able to use the four-part name and query the tables in MySQL but it doesnt allow you. for example you cannot do something like...
Select * from MySqlServer.DbName.Schema.TableName
For some reason it throws an error. So the question whether I can use T-SQL in SSMS to query a Linked MySQL Server? Nope, unfortunately not.
But alternatively Microsoft recommends using OPENQUERY to execute queries to a linked server.
When using OPENQUERY, SQL Server does not try to parse the query, it just sends it to the linked server as it is. which means you can/should be able to write MySQL in SSMS using OPENQUERY and it will work.
Using SSIS with MySQL
Even though SSIS is Microsoft's tool that comes with SQL Server but it is a proper ETL tool which can read data from multiple sources and send data to many types of destination.
Once you have used the appropriate driver to connect to MySQL and ported data in SSIS package , its really not relevant anymore, where the data came from? you would have access to all the SSIS tools and you should be able to use them as if the data was coming from a flat file, SQL Server or Excel sheet etc.
By using Linked Server in MSSQL you can also connect to mySql. for that you need to download ODBC drivers. and then you have to create new dsn and while creating dsn you have to insert mySql server's details. then you can further search regarding how to create Linked server on SQL SERVER. This option is very easy and Totally free. You can use OPEN QUERY FOR inserting, updating, deleting and also get the data out from mySQL.

Migrate mysql tables to existing sql database

How can I migrate mysql tables to an already existing sql database.I have tried using sql server migration assistant for mysql tool, but it migrates entire database to a new database in sql server.Is it possible to transfer mysql tables to existing sql database?
Please help
If you have MySQL workbench and you only need the table structures you can select the tables that you need then:
Right Click > Copy to clipboard > Create Statement
Then past these into your new database an excecute
you can create a linked server the target system; this way you can import the tables selecting the data into the new tables on sql server.
if you already have the DDL migrated then you can fill the tables otherwise you can create the tables while copying the data.
with little scripting you can have the SQL code needed to copy the data ready in minutes.
there are many SO posts about interacting with MySQL from SQL-Server:
Can't create linked server - sql server and mysql
SELECT * FROM Linked MySQL server
Do I have to use OpenQuery to query a MySQL Linked Server from SQL Server?
Have you tried the Import/Export Wizard from within SQL Server Management Studio - it's essentially SSIS (an ETL tool) behind the scenes. It allows you to select specific objects, do transforms and such. I'd expect you'd be able to use a standard ODBC driver.
MSSQLTips has an article that seems relevant:
https://www.mssqltips.com/sqlservertutorial/2205/mysql-to-sql-server-data-migration/

Linked server in MySQL Workbench

I am working with MySQL Workbench and I want to query 2 servers at the same time. I searched and find out that the best way to proceed is to create a linked server.
I am wondering is it possible to create this only using workbench or MySQL server in general ?
There's nothing in MySQL Workbench that lets you send a query to more than one server at a time.

I need to create a table in MYSQL from MSSQL and insert/update data

I have a MS SQL 2008 server with a database and need to create a table in MYSQL from a table/data in MS SQL. The mysql database has been linked and I have full access to the database. Can I do this using openquery?
OPENQUERY doesn't let you run DDL statements against remote databases. To the best of my knowledge, MySQL doesn't have an equivalent method of interacting with other RDBMS's.
You can however do this from SQL Server using the Import/Export Wizard to copy your table to MySQL. You may need to install MyOleDB or a similar driver to connect to MySQL.
Please see http://msdn.microsoft.com/en-us/library/ms140052%28v=sql.105%29.aspx

Convert My SQL database to MS SQL database

I wanted to know if there is a way to convert a .sql file (My SQL backup) to .bak file (MS SQL backup)?
I am currently using MS SQL Server Management Studio Express 2005
Not really. An almost easy way to accomplish this is below.
Install a MySQL server and restore the .sql into it.
Then in your SQL Server create a linked server to the MySQL server.
You can then select the tables in the MySQL server over to SQL Server with something similar to below.
SELECT *
INTO [TABLENAME]
FROM OPENQUERY([LINKEDSERVERNAME], 'SELECT * FROM MYSQLTABLENAME')
Using INFORMATION_SCHEMA on the MySQL server, dynamic SQL, variables and a cursor you can loop through all the tables without coding for each table.
Don't forget to turn off the temporary MySQL instance. It only needs to be on while you're restoring/extracting from it.
And since *.bak are proprietary you have to create that once you've pulled all the tables into the SQL Server DB. Not sure if you really needed the BK or just the SQL Server Database.
While this may sound painful you're really talking less the 50 lines of code. Also, SQL Server will mostly handle the typing for you.