cancel
Showing results for 
Search instead for 
Did you mean: 
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
Carousel_PBI_Wave1

2023 Release Wave 1 Plans

Power BI release plans for 2023 release wave 1 describes all new features releasing from April 2023 through September 2023.

Power BI Summit Carousel 2

Global Power BI Training

Make sure you register today for the Power BI Summit 2023. Don't miss all of the great sessions and speakers!

BizApps LATAM 2023

Business Application LATAM Summit 2023

Join the biggest FREE Business Applications Event in LATAM this February.

Power Platform Bootcamp

Global Power Platform Bootcamp

In this bootcamp we will deep-dive into Microsoft’s Power Platform stack with hands-on sessions and labs, delivered to you by experts and community leaders.

Top Solution Authors
Top Kudoed Authors