cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
konradjonsson
Helper I
Helper I

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
Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.