且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将MYSQL查询转换为MSSQL查询

更新时间:2023-02-14 11:13:53

来自此"SQL Server MySQL迁移助手"工具,并使用该工具将单个MySQL查询转换为SQL Server查询:

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:

  1. 创建项目:下载SSMA,创建项目和连接数据库所需的所有信息位于在MySQL Metadata Explorer中,导航到MySQL数据库的Statements目录:

    In the MySQL Metadata Explorer, navigate to the Statements directory of your MySQL database:

    1. 将要转换的查询粘贴到查询编辑器窗口中,例如: SELECT post_title, post_date FROM wp_posts ORDER BY post_date LIMIT 5 OFFSET 5;
    1. 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;

    1. 返回MySQL元数据浏览器,右键单击Statements并选择Convert Schema:

    1. 当系统提示您保存更改时,选择是":

    1. 从SQL Server查询编辑器窗口中复制转换后的查询:

    请注意,SSMA无法成功转换所有MySQL查询,但大多数情况下都可以转换.它不翻译某些特定于MySQL的功能(例如FOUND_ROW()).

    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()).