(A similar question already exists, but it relates to Oracle rather than MySQL.)
I have a MySQL table which I've connected to SQL Server as a linked server via ODBC (MySQL ODBC 8.0 Unicode Driver). One of it's fields (called meta_value) is a longtext field.
Using SQL Server I can select data from the table like this:
SELECT * FROM OPENQUERY(MY_LINKED_SERVER, 'SELECT entry_id, meta_key, meta_value FROM wp_gf_entry_meta')
However, I can't select data like this:
SELECT EXEC ('SELECT entry_id, meta_key, meta_value FROM wp_gf_entry_meta') AT MY_LINKED_SERVER
When I try to do so, I get the following error message:
OLE DB provider "STREAM" for linked server "(null)" returned message "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.".
Msg 0, Level 11, State 0, Line 72
A severe error occurred on the current command. The results, if any, should be discarded.
If I exclude the longtext field from the query, then I receive the expected results with both OPENQUERY and EXEC AT.
The above queries are merely examples. The query I really want to run is more than 8,000 characters long, which means I can't use OPENQUERY.
How should I fix or workaround this problem?