I'm trying to use OPENQUERY to get some data from MySQL, but I need to get the results into a temp table to manipulate.
I've tried a couple of examples but getting the same error:
DECLARE @lastid int = (SELECT MAX(remoteid) FROM cdr)
DECLARE @TSQL varchar(8000)
SELECT @TSQL = 'SELECT * FROM OPENQUERY([PBXA_MYSQL],''SELECT * INTO #tempcdr FROM asterisk.cdr WHERE id > ''''' + CAST(@lastid as varchar(50)) + ''''''')'
EXEC (@TSQL)
SELECT * FROM #tempcdr
Cannot get the column information from OLE DB provider "MSDASQL" for linked server "PBXA_MYSQL".
A normal select works fine, but select into has that error.
Thanks