简体   繁体   English

从 MySQL 迁移到 MSSQL

[英]Migration from MySQL to MSSQL

I have a PHP application using PDO for database access.我有一个使用 PDO 进行数据库访问的 PHP 应用程序。

This application has to be extended to create tables in and write data to a Microsoft SQL-Server (MSSQL) database.必须扩展此应用程序以在 Microsoft SQL-Server (MSSQL) 数据库中创建表并将数据写入。 For the MSSQL part we don't need transactions.对于 MSSQL 部分,我们不需要事务。

What are the key points to dive in for migrating existing MySQL queries to MSSQL?将现有 MySQL 查询迁移到 MSSQL 的关键点是什么? Will it be done by switching the PDO database driver or are there differences in SQL dialects when INSERTing data or in login procedures?它是通过切换 PDO 数据库驱动程序来完成的,还是在插入数据或登录过程时 SQL 方言存在差异?

Additionally to changing the connection driver, MySQL and SQL Server have many differences in syntax and features.除了更改连接驱动程序之外,MySQL 和 SQL Server 在语法和功能上还有很多不同。 So, unless your commands are REALY simple, you will probably need some query refactoring.因此,除非您的命令非常简单,否则您可能需要进行一些查询重构。

Now, mapping the from and to codes would depend on the commands you use.现在,映射 from 和 to 代码将取决于您使用的命令。 For example, if you use LIMIT n directives, you will need to change those to TOP n syntax.例如,如果您使用 LIMIT n 指令,则需要将它们更改为 TOP n 语法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM