Feedback
Did this article resolve your question/issue?

   

Article

Update statement using SQL Server Linked server to Salesforce fails.

Information

 
TitleUpdate statement using SQL Server Linked server to Salesforce fails.
URL NameUpdate-statement-using-SQL-Server-Linked-server-to-Salesforce-fails
Article Number000136700
EnvironmentProduct: Connect for ODBC Salesforce driver
Version: 7.1
OS: Windows
Database: Salesforce
Application: SQL Server Linked Server
Question/Problem Description
Update statement using SQL Server Linked server to Salesforce fails when connecting with the Connect for ODBC Salesforce driver.
Steps to ReproduceSample query:
update linked_server_name.catalog.schema.object_name set 'XXXXX'='YYYYY' where name like 'ZZZZZZZ'
Clarifying Information
The client is SQL Server Linked Server.
Error MessageOLE DB provider "MSDASQL" for linked server "XXXXXXXX" returned message "[DataDirect][ODBC Salesforce driver]No rows were affected by UPDATE/DELETE WHERE CURRENT OF cursor emulation".
Msg 7343, Level 16, State X, Line X
The OLE DB provider "MSDASQL" for linked server "XXXXXXXX" could not UPDATE table "[XXXXXXX]..[XXXXXXX].[XXXXXXXX]". The consumer could not delete the row. A deletion is pending or has already been transmitted to the data source.
Defect Number
Enhancement Number
Cause
This is not a driver issue.
 
Resolution
When running a query that is not a SELECT query then the best way to do this is to use the SQL Server EXEC function. 

If your linked server cannot use EXEC, you will get a message similar to:
      Server 'linked_server_name' is not configured for RPC.
In this case to use the EXEC function:
 - Right-click on your linked server and choose properties.
 - In the "Server Options" section, set "RPC Out" to "True".
You can then use the EXEC function.

For example using the above query:
exec('update catalog.schema.object_name set "XXXXX"=''YYYYY'' where "NAME" like ''ZZZZZZZ''') at linked_server_name

Note that column names are inside double quotes and data is inside escaped single quotes (two single quotes, one for the escape and one for the single quote).

For additional information refer to the Microsoft documentation.
Workaround
Notes
Last Modified Date4/13/2023 8:00 PM
Files
Disclaimer The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Progress Software Corporation makes all reasonable efforts to verify this information. However, the information provided is for your information only. Progress Software Corporation makes no explicit or implied claims to the validity of this information.

Any sample code provided on this site is not supported under any Progress support program or service. The sample code is provided on an "AS IS" basis. Progress makes no warranties, express or implied, and disclaims all implied warranties including, without limitation, the implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample code is borne by the user. In no event shall Progress, its employees, or anyone else involved in the creation, production, or delivery of the code be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample code, even if Progress has been advised of the possibility of such damages.