February 3, 2022 at 2:36 pm
Hello,
I have a Windows 2019 machine with SQL Server 2019. I have created a linked server to Db2 database using 'Microsoft OLE DB provider for ODBC Drivers'. I am using our own ODBC driver.
I am running an update query from SSMS as shown below.
UPDATE OPENQUERY(TEST2019,'select prodnum, prodname,prodprice from Q.PRODUCTS where prodnum = 10')
set prodname = 'GENERATOR1', prodprice = 61 where prodnum = 10
The above does an positional update. Basically, the SELECT query will be run first & followed by the below UPDATE query.
UPDATE Q.PRODUCTS SET PRODNAME=?,PRODPRICE=? WHERE (PRODNUM=? AND PRODNAME=? AND PRODPRICE=? )
From the ODBC trace, I see that the parameter number in SQLBindParameter is not coming properly for some of the parameters.
The following is seen in trace.
Parameter number Parameter Marker
1 'PRODNAME=?'
2 'PRODPRICE=?'
3 'PRODNUM=?'
3 'PRODNAME=?'
3 'PRODPRICE=?'
Ideally it should be,
Parameter number Parameter Marker
1 'PRODNAME=?'
2 'PRODPRICE=?'
3 'PRODNUM=?'
4 'PRODNAME=?'
5 'PRODPRICE=?'
The same query works fine on SQL Server 2019 on Windows 2016 machine.
I want to analyze the 'Microsoft OLE DB provider for ODBC Drivers' trace or MSDASQL trace to understand the issue.
How to enable the 'Microsoft OLE DB provider for ODBC Drivers' trace or MSDASQL trace in SSMS?
Any other method to analyze the above problem?
Thanks
February 4, 2022 at 3:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply