Updating MySQL with data from MS SQL Server - mysql

In MySQL is it possible to execute an update query with values selected from external MS SQL database?
I would like to execute every night a timed query, which updates some the data in MySQL with data on MS SQL server.

Typically how you would do this is, create a SSIS package (dts) that pulls the data in and does anything else you want to do. Then setup a SQL job to run the package, then Setup a A SQL batch to kick off the job whenever you want it to run

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.

MSSQL to MYSQL one way data syncing

i have one MySQL server.
in that server there are the 15 databases and i need to sync the data to MsSQL to MySQL and the condition is a data transmit only MsSQL to MySQL on every update. so please guide me how to perform this task and how to set cron job.

Transfer sql server data to mysql database using program

I have an old system with sql server database. And I have to create a webiste with mysql database. The old system is still in use and is inserting data to the sql server DB everyday. So, I am thinking write a program that automatically transfer data from the sql server DB to the mysql DB. Any good suggestions? Thanks.
You have an active SQL Server database.
Unless you are planning to decommission this database server (for very good reasons not related to this new application), then the new application should simply query this server.
You can create a small (Maybe in c#) program that keeps running all the times with a timer, and on this timer, get all rows from SQL server that are not marked as "Copied", insert them on MySQL and the update those rows as "Copied". That program need to have access to both databases.

How to migrate daily data from Oracle table to MySQL table using Shell script?

I needed to insert data to a MySQL table. The data usually comes from the Oracle database by a SQL file which has some query to get data from Oracle database table.
So i needed to automate this process on a daily basis using Shell script. So it will run the SQL file (Oracle) and get data. The data has to be moved to a specific MySQL table.
So the operation like,
Connecting to Oracle server.
Executing SQL in that server.
Move collected data to the MySQL table.
I want to run that operation as a cron on daily basis.
I am working on LAMPP environment.
Here are my questions,
Is there any standard tools available to do that?
Can we achieve this using shell script? If so, Please suggest me the steps.
Or It would be great if you suggest me your own optimized way.
Thanks,
Raja.
You can achieve this using a cron job,
Write a sql file which exports a data from Oracle DB i.e. sql file containing export table command with appropriate where clause
Write a sql file which imports data into Mysql DB i.e. similar import file command in Mysql
Write a shell file which run both these sql files and verifies the data in Mysql table
Schedule a cron job to run this shell script daily at a specific hr.
Please check import/export file formats on Oracle and Mysql which can be different as one is freeware and other is commercial. If there are differences then you will need some data/file modification otherwise this should be enough.

SQL Server 2008 Schedule Timed Job to Run

I have a .sql script file that I want to run once every 24 hours. What are the best (and easiest) steps to produce a scheduled task in SQL Server 2008 to do this?
Thanks.
You could use the SQL Server Agent (if you are not using the Express version of SQL Server). In Management Studio, expand the SQL Server Agent node, right-click on Jobs and click New Job...
From there you will be able to schedule all kinds of jobs, including running a script every 24 hours.
You can create a job with the SQL Server Agent.
SQL Server Agent uses SQL Server to store job information. Jobs
contain one or more job steps. Each step contains its own task, for
example, backing up a database.
SQL Server Agent can run a job on a schedule, in response to a
specific event, or on demand. For example, if you want to back up all
the company servers every weekday after hours, you can automate this
task. Schedule the backup to run after 22:00 Monday through Friday; if
the backup encounters a problem, SQL Server Agent can record the event
and notify you.
You can run a job based on a specific schedule and it can execute a stored procedure, SSIS, etc.
To create a new job, in SQL Server Management Studio, under the SQL Server Agent, right-click the Jobs and select New Job.
Here is a step by step from MSDN on creating a job:
http://msdn.microsoft.com/en-us/library/ms190268.aspx
In you SQL Server Agent
1. right click jobs to add a new job
2. Give it a name and make sure the owner has the access the execute access to the database.
3. under steps and a new step. You can simply copy paste the script in the text area, select the database you want to run in on click OK.
4. under schedule click add new schedule and select time, occurrence, start and end time
5. click ok and you are done.
Hope it helps you and anyone else who came across this and still wasn't sure how it works just like me :)
Well, if you do not have SQL agent or full SQL version: you could schedule a task to run a batch file in Windows scheduler that "calls" on the SQL script. This is my batch file for example: SQLCMD.EXE -S sqlServerInstanceName -E -i C:_software\mySQLscript2Execute.sql . Remember to save your file with .bat extension. Thanks : chagbert