I'm querying a MySQL linked server from SQL Server.
I can query the linked server using OpenQuery as in the following example.
SELECT * FROM OPENQUERY(MyLinkedServer, 'SELECT * FROM SomeTable')
I have tried querying the linked server using a four-part name as in the following example.
SELECT * FROM MyLinkedServer.MyDatabase.DBO.SomeTable
That returns an error stating that "the provider does not expose the necessary interfaces to use a catalog or schema."
Is there any way to query a linked server without using OpenQuery?
Thanks!
Update: Per Shredder's answer, the correct syntax is as follows.
SELECT * FROM MyLinkedServer...SomeTable
It is possible, but MS recommends that you use the openquery:
This method lets SQL Server send the command directly to the linked OLAP provider, without trying to parse it.
You can have a look at the examples here under "Linked server examples with four-part names"
Also, I found this :
If you receive these error messages, a table may be missing in the [Linked DB] schema or you may not have permissions on that table.
I would verify that your mysql db has given access rights to your sql server.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.