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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
konradjonsson
Helper II
Helper II

Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error

Hi.

The full error message is:

Failed to save modifications to the server. Error returned: 'OLE DB or ODBC error: [DataSource.Error] Microsoft SQL: Incorrect syntax near the keyword 'union'.. '.

 

Trying to append two queries. See all queries below. 

Append – Warranty ratios (BIDW)

let

    Source = Table.Combine({#"Installed base - Power and TiLite (BIDW)", #"Warranty ratios (BIDW)"})

in

    Source

 

Installed base – Power and TiLite (BIDW)

let

    Source = Sql.Databases("SERVER"),

    DATABASE = Source{[Name="DATABASE"]}[Data],

    DW_V_InvoiceDetailsUNION = DATABASE{[Schema="DW",Item="V_InvoiceDetailsUNION"]}[Data],

    #"Removed Other Columns" = Table.SelectColumns(DW_V_InvoiceDetailsUNION,{"WKInvoiceDate", "WKCustomer", "WKProduct", "IsChair", "SerialNumber"}),

    #"Filtered Rows" = Table.SelectRows(#"Removed Other Columns", each ([SerialNumber] <> null and [SerialNumber] <> "" and [SerialNumber] <> "NA") and ([IsChair] = 1)),

    #"Sorted Rows" = Table.Sort(#"Filtered Rows",{{"WKInvoiceDate", Order.Ascending}})

in

    #"Sorted Rows"

 

 

Warranty ratios (BIDW)

let

    Source = Sql.Databases("SERVER"),

    DATABASE = Source{[Name="DATABASE"]}[Data],

    DW_V_InvoiceDetailsUNION = DATABASE{[Schema="DW",Item="V_InvoiceDetailsUNION"]}[Data],

    #"Removed Other Columns" = Table.SelectColumns(DW_V_InvoiceDetailsUNION,{"WKInvoiceDate", "WKCompany", "WKCustomer", "WKProduct", "WKOrderCategory", "SerialNumber", "NetAmount", "CostAmount", "OrderQuantity"}),

    #"Filtered Rows1" = Table.SelectRows(#"Removed Other Columns", each ([SerialNumber] <> null and [SerialNumber] <> "" and [SerialNumber] <> "NA") and ([WKOrderCategory] = 6)),

    #"Filtered Rows2" = Table.SelectRows(#"Filtered Rows1", each [WKInvoiceDate] >= #date(2015, 1, 1))

in

    #"Filtered Rows2"

 

1 ACCEPTED SOLUTION

Hi.

Thanks. I found another solution, in another topic. I removed the sorting from one of the underlying queries -then the problem disappeared.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @konradjonsson 

 

It seems both of the queries you want to append are from the same table in the same database. And I think your queries are good and I don't see any error.

 

Where do you use the Power Query Editor? In Power BI Desktop, Excel or Dataflow? If you are using Power BI Desktop, can you update it to the latest version and try the append operation again?

 

If updating the version of the application doesn't solve this problem, you could consider removing the applied steps one by one from the last step to check whether some specific transformation step caused this error. 

 

You could also first connect to the same table in both queries and append the queries before any transformation to check whether they can be appended. If there is no error, then add the proceeding steps to transform the queries. If you find a step would cause this error, remove it and think about adding it in the appended query.

 

Hope this helps.

 

Regards,
Community Support Team _ Jing
If this post helps, please Accept it as the solution to help other members find it.

Hi.

Thanks. I found another solution, in another topic. I removed the sorting from one of the underlying queries -then the problem disappeared.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors
Top Kudoed Authors