I've 700+ MySQL queries and now trying to create same set of queries in MSSQL.
I want to generate MSSQL query with same MYSQL.Is any way to convert MYSQL query into MSSQL query.
From this article by Brian Swan, you can download the SQL Server Migration Assistant for MySQL tool and use it to convert a single MySQL query to a SQL Server query:
Create a Project: All the information you need for downloading SSMA, creating a project and connecting to databases is in steps 1-6 of this blog post.
In the MySQL Metadata Explorer, navigate to the Statements directory of your MySQL database:
Paste the query you want to convert into the query editor window, e.g:
SELECT post_title, post_date FROM wp_posts ORDER BY post_date LIMIT 5 OFFSET 5;
Back in the MySQL metadata explorer, right-click Statements and select Convert Schema:
When prompted to save changes, select Yes:
Copy the converted query from the SQL Server query editor window:
Note that SSMA will not successfully translate all MySQL queries, but it does for most. It does not translate some MySQL-specific functions (for example FOUND_ROW()).
Related
i'm working on a school project and i'm building a little server in NodeJS for our project, one of my tasks is to find a way to get the tables name of all "user"tables in the selected Database.
Since i need to connect to different SQL databases, MySQL - PostgreSQL - SQLite, i was looking to get the same result by exectuing the same query, i'll explain my self.
I've start working on MySQL and i've "found" this query:
`SELECT table_name FROM information_schema.tables WHERE table_schema ='${config.DB_Name}'`
And it correctly return all the table name from the selected database. After that i moved to work with PostgreSQL and that query (succesfully run) returns 0 result.
So i've start looking for another query that can return the same result in Postgres, and i found this:
SELECT table_name
FROM information_schema.tables
WHERE table_schema='public'
AND table_type='BASE TABLE';
I was wondering, is there any Query which, run on MySQL-PostgreSQL-SQLite, give me the same kind of result?
Your PostgreSQL query will work fine on all databases that support SQL standard feature F021. If it doesn't work in MySQL, then either it doesn't support that feature, or it is a bug.
Note that what PostgreSQL and the SQL standard calls a schema is called "database" in 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.
I have a view on a Mysql database. I work with it using phpMyAdmin.
I need to see the select statement that builds up this query. Unfortunately I cannot have access to the database files (i know the query is stored there).
I need to find a way, using phpMyAdmin or an SQL statement, that allow me to see the select statement that is inside the view.
You can find this information in INFORMATION_SCHEMA database, e.g. -
SELECT * FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = 'db_name' AND TABLE_NAME = 'view_name';
Also, try visual object editors or Object Viewer to view/edit views in dbForge Studio for MySQL (free express edition).
Try the sql query:
SHOW CREATE TABLE blah;
http://dev.mysql.com/doc/refman/5.0/en/show-create-table.html
Suppose that I want to execute two query one is-
select * from table1;
select * from table2;
if I want to execute it I need to remove one query from two then I can execute, I'm using mysql query browser1.2.12.
If we use script tab then I can not see the output, is there any way to execute one of query from multiple query after selection.
that functionality is not available in mysql query browser on any version.
Mysql Query Browser is getting old nowdays. Mysql launch the new generation IDE with name Mysql Workbench.
use it,here u got more options.
enjoy!!
click here for workbench
alt text http://www.freeimagehosting.net/uploads/64fac9c8c4.gif
is it possible to generate sql scripts from for all tables ? i want to generate the sql script and import into another database server
Select the tables you want to export, right click, scripts>create table script. It works in mysql, not sure about oracle.
For anyone on the 3.4.0 version on OSX, I had to do it this way:
Select the DB
Session >> SQL Server >> Generate T-SQL Script
Select the Objects/Tables wanted
Saves to a file, but gives you no progress indicator, so give it a while to run.