Overview
While MySQL and Microsoft SQL share many similarities, there are key differences in syntax that you'll need to understand when working with Pipeline Cloud. This guide will help you adapt your existing MySQL queries to work properly in the Microsoft SQL environment.
Step 1: Understand basic syntax differences
-
Many common commands work the same way in both systems:
-
COUNT() for counting rows
-
ORDER BY for sorting results
-
DISTINCT for returning unique rows
-
Column aliases can be created using AS or space
-
Step 2: Adapt join syntax
-
In Microsoft SQL, always include the ON clause with join conditions:
SELECT co.VanID, co.FirstName, co.LastName FROM Contacts co INNER JOIN ContactsAddresses ca ON co.VanID = ca.VanID WHERE ca.DateCreated BETWEEN '1/1/2020' and '1/31/2020'
Step 3: Change result limiting syntax
-
Replace MySQL's LIMIT with TOP in Microsoft SQL:
-
MySQL: SELECT * FROM cons LIMIT 5
-
Microsoft SQL: SELECT TOP 5 * FROM Contacts
-
Note that TOP appears directly after SELECT, not at the end of the query
Step 4: Update string concatenation
-
Use the plus sign (+) instead of CONCAT() function:
-
MySQL: SELECT CONCAT(firstname, lastname, cons_id)
-
Microsoft SQL: SELECT firstname + lastname + CONVERT(VARCHAR(20), VanID)
-
Remember to use CONVERT or CAST when concatenating non-string values with strings
Step 5: Adjust batch delimiters
-
Use GO instead of semicolons to separate batches:
-
MySQL uses semicolons (;)
-
Microsoft SQL uses GO (semicolons are optional for ending statements)
Not quite what you were searching for?
- Navigate back to the Pipeline Cloud Resource Index.
How do I convert MySQL queries to Microsoft SQL? | What SQL syntax does Pipeline Cloud use? | How do I use TOP instead of LIMIT in Pipeline Cloud? | Why doesn't my MySQL query work in Pipeline Cloud? | How do I convert MySQL CONCAT to Microsoft SQL? | How do I write SQL queries for Pipeline Cloud? | What are the differences between MySQL and Microsoft SQL in Pipeline Cloud?
