We have local SQL Server data that we would like to sync to Redshift nightly. I can write individual values to the Redshift server, but can not can do a standard insert of data from a local table
Using this type command single line inserts work as expected:
EXEC('INSERT INTO [red_dw].[marketing].[CertainReg] (registrationcode, eventcode, dateregistered) (SELECT '4', '2', GETDATE())') AT REDDW
Running this code:
INSERT INTO [REDDW].[red_dw].[marketing].[certainreg] (registrationcode, eventcode, dateregistered)
SELECT *
FROM CertainReg
throws the following error:
OLE DB provider "MSDASQL" for linked server "REDDW" returned message "Unspecified error".
OLE DB provider "MSDASQL" for linked server "REDDW" returned message "Transaction cannot have multiple recordsets with this cursor type. Change the cursor type, commit the transaction, or close one of the recordsets.".Msg 7343, Level 16, State 2, Line 23
The OLE DB provider "MSDASQL" for linked server "REDDW" could not INSERT INTO table "[REDDW].[red_dw].[marketing].[certainreg]".
Can you tell what is wrong with the code or is there a better way to sync tables to Redshift nightly. I believe I am missing something basic, but lot's of searching the web has not produced any results.
CertainRegtable on the SQL Server side?insert into openquery(redshift, 'select * from targettable') select * from sourcethese linked servers are very finicky, although it looks like redshift messed something up in implementation. Also, check so column number match between servers