Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 views
in Technique[技术] by (71.8m points)

sql - SELECT * FROM Linked MySQL server

I have a SQL Server 2012.(120.120.55.15)

Today I linked MySQL server(120.120.55.30) to my SQLServer and gave it a name "MYSQL".

In Object Explorer everything seems fine. I can see MySQL server's database "exampleDataBase" and tables in it.

But when I try to run select query like this:

SELECT * 
FROM   openquery
        (
        MYSQL, 
        '
         SELECT * 
         FROM [exampleDataBase].[msProcMatrix]
        '
        )

I get a mistake:

Msg 7399, Level 16, State 1, Line 1 The OLE DB provider "MSDASQL" for linked server "MYSQL" reported an error. The provider did not give any information about the error. Msg 7350, Level 16, State 2, Line 1 Cannot get the column information from OLE DB provider "MSDASQL" for linked server "MYSQL".

What should be additionally done to use my linked MySQL server?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Found the decision:

SELECT * 
FROM openquery(MYSQL, 'SELECT * FROM exampleDataBase.msProcMatrix')

Without brackets!

Strange for me but works...


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...