1

I have a problem when importing a table form SQL Server to MySQL.

This is what I do:

  1. First I export a CSV file with the data of the table Clients from SQL Server.
  2. Then I import that CSV file to an auxiliar table in MySQL.
  3. Finaly, I execute a query to insert the new data into the Clients table from MySQL

Is there any way to automatize this process? I've tried several methods, but it wasn't successful. ( Methods such as link both servers and configure them. )

English is not my first language.

Kind regards.

Drew McGowen
  • 11,471
  • 1
  • 31
  • 57
Pepemujica
  • 123
  • 7
  • 1
    don't use csv. it's a crap absolute-last-ditch-before-you-slit-your-wrists format. there's far better tools for export/import between disparate databases. – Marc B Nov 01 '16 at 14:40
  • You should be able to create a linked server between them and execute your insert directly into MySQL. Take this code once working and put it into a scheduled job. Based on the questions wording I assume you are moving data from SQL Server to MySQL. – Neo Nov 01 '16 at 14:46
  • @MisterPositive Yes, that was exactly what I've tried, but could't make the conection from MySQL Workbench to SQL Server – Pepemujica Nov 01 '16 at 14:47
  • I would recommend you debug making that connection. Instead of pulling from MySQL you should be able to push from SQL Server as well. – Neo Nov 01 '16 at 14:49
  • 1
    What did you try to make the connection? How did it fail? Was there an error message? – David Rushton Nov 01 '16 at 14:50
  • @destination-data first I couldn't instal the odbc for MySQL, and the couldn't instal the MySQL Workbench – Pepemujica Nov 01 '16 at 14:55
  • Why not? Did the installs fail? If so, did they return an error message? The more detail you provide; the more likely you are to find the right answer. Tip: Add extra details to your question, not everyone reads all the comments. – David Rushton Nov 01 '16 at 14:58
  • @destination-data So, now I could isntall it, I needed to install c++ before. But still can't link the servers. Whe I choose data sourse in the obdc option, never apears MySQL – Pepemujica Nov 01 '16 at 16:38
  • what do you mean by "automate"? A one-off for many tables, many databases, or do you mean periodic migrations of a single table, with incremental additions ("append to table")? – knb Nov 01 '16 at 16:59
  • @destination-data Now I could make some progress, but still having problemes. I can't create the linked server from SQL server, it sais that couldn't test the connection – Pepemujica Nov 01 '16 at 17:10

1 Answers1

0

You should be able to create a linked server between them and execute your insert directly into MySQL. Take this code once working and put it into a scheduled job.

MySQL Linked Server Set Up

Community
  • 1
  • 1
Neo
  • 3,309
  • 7
  • 35
  • 44