Skip to content
Advertisement

SQL Query doesn’t work in Azure SQL Data Warehouse (Synapse) why not?

I have an SQL query that works in an on-premise SQL Database, but when I try to execute it on an Azure SQL Data Warehouse, I get an error. Does anyone know another way of writing this SQL Query so that it will work in Azure DW?

SQL Query is:

Azure DW Error is:

Msg 103010, Level 16, State 1, Line 1 Parse error at line: 1, column: 39: Incorrect syntax near ‘(‘.

Here is the full SQL Query (real table names have been removed)

Advertisement

Answer

The Table Value Constructor is nice but is not fully supported in Azure Synapse Analytics as per the documentation, ie Synapse is absent in the Applies to list at the top of the linked doc. VALUES is supported for single rows as per this example, but the easiest fix for your example is to simply rewrite as a simple UNION ALL statement, eg

It’s just syntactic sugar really. They are all set operations at the end of the day.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement