Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
konradjonsson
Helper II
Helper II

OLE DB or ODBC error incorrect syntax near the keyword 'union'

Hi.

 

I have a problem when I try to append two queries.

The queries I am trying to append are retreiving data from an SQL server (same server, same database, same table).

 

The error message is:

OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: Incorrect syntax near the keyword 'union'.. '.

 

I have seen earlier posts on the same topic, but I have not seen (or understood) what the solution is.

One control question made by a community member was; "Did you happen to use a native query when you connected to your data source?" (I do not know what a native query is, or what other queries there are)

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi  @konradjonsson ,

 

Native query refers to actual sql queries (referring to actual database objects). These queries are the sql statements which can be directly executed in database using a database client.

Check similar thread below to solve your issue:

https://community.powerbi.com/t5/Service/Microsoft-SQL-Incorrect-syntax-near-the-keyword-union-Table...

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi  @konradjonsson ,

 

Native query refers to actual sql queries (referring to actual database objects). These queries are the sql statements which can be directly executed in database using a database client.

Check similar thread below to solve your issue:

https://community.powerbi.com/t5/Service/Microsoft-SQL-Incorrect-syntax-near-the-keyword-union-Table...

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Thanks! The link you provided showed a solution that included removing the 'sorted rows'-step. I removed the sorted rows and then it worked.

Hi Kelly.

Thanks. The native query aspect mentioned was only to highlight that I had seen that comment in earlier questions on the error. I have now also understood that I am not using native queries.

 

What I need help with is to understand why I get the error when trying to append two other queries.

Hi  @konradjonsson ,

 

Sometimes the error happens when the transformations in previous steps are not allowed or there are some conflicts between transformations.

 

Best Regards,
Kelly

Did I answer your question? Mark my post as a solution!

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Solution Authors