0


I have MSSQL2016, are attached to the server with MySQL ODBC driver (MySQL driver for ODBC 5.3). In the ODBC settings not specify database default.
How do I make the query to any table?
Query like:
- select * from [Mysql]..[DataBase].[Table]
- select * from [Mysql].[DataBase]..[Table] error: nvalid use of schema or catalog for OLE DB provider "%ls" for linked server "%ls". A four-part name was supplied, but the provider does not expose the necessary interfaces to use a catalog or schema.
- select * from [Mysql].[DataBase].[Table] error: Invalid object name 'Mysql.DataBase.Table'.
dont work.

But if i set default database queries here are: - select * from [Mysql]...[Table]
work.

But I need the first case to query 2 database on 1 server like: - select * from [Mysql].[DataBase1].[Table]
- select * from [Mysql].[DataBase2].[Table]

How can I do it?

  • Why not simply use UNION ALL? – Sean Lange Oct 24 '17 at 15:45
  • The problem is not UNION, problem is that I can not create a query to different databases on the same server. – Timofey Sinichkin Oct 24 '17 at 15:51
  • I don't know anything about mysql but perhaps you could share the error message instead of simply "dont work". – Sean Lange Oct 24 '17 at 15:54
  • I have added the error in the first post – Timofey Sinichkin Oct 24 '17 at 16:04
  • I have 1 server, 2 databases and many tables inside. I can do requests only if I specify the database in ODBC. But then I can't do request to the other base. I tried to specify a database name in the query, but the query does not work. MY sql server linked to mssql. – Timofey Sinichkin Oct 24 '17 at 16:22
  • when You add Linked server ( MySQL in particular ), You set as part of connection database name. So query have to be like select * from [Mysql]...[Table]. Another possibility is to ask select * from openquery(Mysql,'select * from Table') – DimaSUN Oct 26 '17 at 15:07

0 Answers0