What are the SQL Server query syntax not supported by MySQL?

izj3ouym  于 2023-03-28  发布在  SQL Server
关注(0)|答案(2)|浏览(158)

I am working in a project where we are using SQL Server database currently. But recently a decision has been taken that the database will be changed to MySQL.

I am not using any stored procedures, views, triggers, user defined functions, etc. But I think even then some queries written for SQL Server will not be supported by MySQL.

What are the things that I have to check (and change) so that all the queries will work properly for MySQL also?

vhmi4jdf

vhmi4jdf1#

Queries that I know without consulting the documentation that will not work:

  • (recursive) common table expressions
  • windowing functions
  • queries using the standard SQL string concatenation ||
  • UPDATEs with JOIN are different between the two systems
  • Date arithmetics: date_column + 1 behaves differently in SQL Server
  • Division by zero will produce an error
  • SQL Server will reject values that do not fit into a column (instead of silently truncating it, which MySQL does in the default installation)

DDL that will not work and might have an impact on performance and/or data quality

  • datetime columns where you need precision up to milliseconds
  • tables with check constraints
  • indexed views
  • triggers on views
  • table functions ( select * from my_function(42); )
  • filtered indexes ("partial index")
  • function based indexes
9gm1akwq

9gm1akwq2#

There's always the option to take commercial support from MySQL AB for this problem. I'm pretty sure they've done enough MSSQL->MySQL migrations to know alot about that. If a price tag on the migration is not a problem.

Alternatively, you could try to run the MySQL Migration Toolkit over the data and look for meaningful error messages at the stuff it cannot migrate. MySQL Migration Toolkit is part of the MySQL GUI Tools.

相关问题