Home > Documentation > MySQL to MS SQL

Convert Views

One of the important steps of MySQL to SQL Server database migration is queries conversion. This article gives 20 tips on how to modify MySQL views to make it compatible with Microsoft SQL Server format. The target audience for this guide should have general database management knowledge and experience in composing SQL queries.

First, you need to get list of all views in database as follows:

SELECT table_name, view_definition
 FROM information_schema.views
   WHERE table_schema='0atabase name%';

And then start to modify each MS SQL view query according to the following rules:

Also you should remember that unlike MySQL SQL Server requires all selected columns in SELECT ... GROUP BY ... queries to be either under GROUP BY clause or in aggregation functions.

Of course, there are a lot of newances staying outside of this article, it just covers the most frequent issues in migrating views from MySQL to MS SQL. If you need a solution for complete migration of MySQL database to MS SQL server, take a look at MySQL-to-MSSQL converter.

Have any questions? Contact us