October 12, 2014 at 10:04 pm
Comments posted to this topic are about the item Linked server creation to MySQL Server
October 13, 2014 at 2:33 am
Beware!
SELECT TOP 10 * FROM MYSQL...test_table
Will pull all rows from test_table across the network to the MSSQL server, then return the top 10. If that sounds like a bad idea (try doing this on a large table over a slow link), use OPENQUERY to get your results (you'll need to use the correct MYSQL syntax).
October 13, 2014 at 4:03 am
martin-705756 (10/13/2014)
Beware!SELECT TOP 10 * FROM MYSQL...test_table
Will pull all rows from test_table across the network to the MSSQL server, then return the top 10. If that sounds like a bad idea (try doing this on a large table over a slow link), use OPENQUERY to get your results (you'll need to use the correct MYSQL syntax).
Is this behavior the same in SQL Server linked servers or only in MySQL?
October 13, 2014 at 4:10 am
I'm ready to be corrected, but I'm pretty sure it's only non-MSSQL servers.
This is because you can't directly query MYSQL (or other SQL flavours) with MSSQL server syntax - e.g. the example "select top 10 * from MYSQL...test_table" translates to MYSQL as "select * from test_table limit 10"
I'm not an authority on this - just got burnt by querying a production MySQL db in an outside data centre from MSSQL - nobody loves you when you kill the link!
October 13, 2014 at 1:05 pm
martin-705756 (10/13/2014)
I'm ready to be corrected, but I'm pretty sure it's only non-MSSQL servers.This is because you can't directly query MYSQL (or other SQL flavours) with MSSQL server syntax - e.g. the example "select top 10 * from MYSQL...test_table" translates to MYSQL as "select * from test_table limit 10"
I'm not an authority on this - just got burnt by querying a production MySQL db in an outside data centre from MSSQL - nobody loves you when you kill the link!
If true, that is disappointing. MySQL does have syntax to limit rows, e.g.:
select * from MYSQL...test_table LIMIT 10
It seems a driver could make this translation at the server, but I'm not expert in that area either.
- webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
October 14, 2014 at 10:06 am
Just to point out,
GRANT ALL ON *.* to fooUser@'<IP Address/Host name of the machine from where you are trying to access MYSQL Server' IDENTIFIED BY '<Password>';
essentially creates a user with full permissions (except for GRANT permissions) on your MySQL server. I would still recommend security best practices and only grant necessary rights to your linked server account (i.e if you're only going to read, GRANT SELECT instead of GRANT ALL).
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply