This is usually an error that is encountered while querying a remote database on a different server instance which says
OLEDB provider "SQLNCLI" for linked server "ABCD" returned message "Deffered prepare could not be completed"
This is the way I could rectify, though this is not the lone mistake that gives this error every time.
Just set the default to the database that is being querying to the user through which the Linked server is connecting to the database.
OLEDB provider "SQLNCLI" for linked server "ABCD" returned message "Deffered prepare could not be completed"
Msg 8180, Level 16, State 1, Line 1
Statement(s) could not be prepared.
This is the way I could rectify, though this is not the lone mistake that gives this error every time.
Just set the default to the database that is being querying to the user through which the Linked server is connecting to the database.
That was it! Thanks. Prefixing the table names in the FROM clause inside the OPENQUERY with the DB name that the tables are in on the linked server fixed the problem.
ReplyDeleteWow. That was easy. I was pulling my hair out over this...
ReplyDeleteThank you very much, this post was a great help to me.
ReplyDeleteRegards,
problem is hard to indentify, but solution is simple.. really Thanks
ReplyDelete