SQL translator › MySQL → T-SQL

MySQL to SQL Server translator

Client sent a MySQL dump. SQL Server wants TOP, ISNULL, and brackets. Paste the query; we rewrite the usual functions.

Usual swaps

MySQLSQL Server
LIMIT nTOP n or OFFSET FETCH
IFNULL(a,b)ISNULL(a, b)
NOW() / CURDATE()GETDATE() / CAST(GETDATE() AS date)
DATE_ADD(d, INTERVAL n DAY)DATEADD(day, n, d)
GROUP_CONCAT(x)STRING_AGG(x, ',')
IF(a,b,c)IIF(a, b, c) or CASE
backticks[brackets]
AUTO_INCREMENTIDENTITY(1,1)

LIMIT with a comma (LIMIT 10, 20) is OFFSET 10 FETCH NEXT 20. TOP cannot do that alone.

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free