Export MSSQL table records to MySQL in .sql file - mysql

i've a MSSQL database and trying to migrate to MySQL database.. the problem is when I using MySQL WorkBench, some table records in my MSSQL database is not migrated (there is an error and MySQL Workbench not responding).. is there any tools to export MSSQL table records into SQL file that compatible to be executed in MySQL?

Both T-SQL and MySQL and support VALUES clause. So, right click on the database and select Generate scripts from Tasks:
Then you can choose objects:
and then make sure you have selected to get the data, too:
You can even get the schema and change it a little bit to match the MySQL syntax.
For small amount of data this is pretty cool. If you are exporting large tables it will be better to use another tool. For example, using bcp you can export your data in CSV format and then import it in the MySQL database.

Related

MySql lost table metadata after exporting the database, how to export mysql schema

I'm using MySQL for few months and created lots of tables and procedures using MySQL Workbench (8.0). I recently bought a new laptop and exported the old database and imported to the new laptop. But I lost all the metadata of tables and procedures. I need to know the create date of a table and when was it last modified. But it looks to me that the metadata(information_schema) was not included with the export. Is there a special way to export the metadata too or to include information_schema with the data export?
Thanks for looking at my question.
UPDATE: I found that mysql schema contains all the metadata information, but I can't see that in MySQL Workbench 8.0. I found in other posts that the mysql schema is very much exists but is hidden in the Workbench. So how will I export it? Is there any harm in moving mysql schema from one server to the other?
If you didn't backup and restore the mysql schema, then data like CREATE_TIME and UPDATE_TIME are likely lost or have changed.
Backing up INFORMATION_SCHEMA doesn't make sense, since the tables are mostly views on internal system tables.

How to retrieve data from phpmyadmin in mysql workbench

I have used database -> reverse engineer to retrieve the schema from phpmyadmin. But when I tried it, the data records that filled in table do not appear in mysql workbench. The things that appear is only the relation and the structure/attribute of the tables. What should I do so that the data records can be retrieve from phpmyadmin? Thank you
Try exporting the database in .sql
Select Database > Export > SQL > Go
You probably tried to reverse engineer the script in the modeling section, which creates a model from the content. A model doesn't work with the actual data, but only the meta data (schema objects and structure).
If you actually want to import the full dump into your server then open an SQL connection to it from the homescreen and execute the script there.

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 Workbench Inserts

I am using MySQL Workbench 5.2.28 for designing my database schema. I need to insert default data into some tables which can be done using the "Inserts" tab. However, it seems like it only allows entering data manually, one row at a time. I have an OUTFILE with several hundred rows that I would like to insert.
Is this possible with MySQL Workbench? Would creating separate MySQL scripts for importing default data be a better approach?
I am now using separate sql scripts for inserting my data as there doesn't seem to be an easy way to add bulk inserts to MySQL workbench.
Generate CSV (quoted if you have comas in values) in Excel for example, then just copy/paste all rows into workbench via 'inserts' tab for each table in model.
Works with Workbench version 5.2.40.
In the MySQL Workbench Version 6.2 you will find a Import Button which alows you to Import Inserts from a CSV File with "," as delemiter.
You are right there is no way I know doing this automatically. The only thing you can do is to generate all your inserts scripts in a single time by doing a forward engeniering and then by copying the insert statements at the end of the generated script (You must check the option "Generate INSERT statements").

How to generate SQL queries

I am using phpMyAdmin to create database tables and fields. I have 100's of tables in a single database. Now I need to make the same on few more servers.
I feel it's too hard to write SQL queries to create that database. Is there any reverse process to generate an SQL query file from phpMyAdmin or anyother tool? I want to create a database in a GUI, and I need the SQL query for my database. Is there any tool to generate it automatically?
If I understood you correctly, you want to export a database (with many tables) using phpMyAdmin, and then import it and use it on another server.
Yes. You can do that.
Select the database on the left-hand side in phpMyAdmin and then:
Export -> Select All Tables -> Adjust Options -> Go.
You are going to get <youdatabasename>.sql file, with all the table definitions inside. Then you can import it in another phpMyAdmin or other database handler.
You can use mysqldump to do this. Then --nodata switch should do what you want.