I have a SQL Server stored procedure that runs correctly every time I start manually using EXEC , but when it runs as part of the SSIS package, it fails with this error:
Executing the query "EXECUTE (ProcName) " failed with the following error: "The OLE DB provider "SQLNCLI10" for linked server "(OtherServer)" reported a change in schema version between compile time ("177833127975044") and run time ("177841717910098") for table (Server.Database.Schema.Table)".
This procedure is a MERGE statement that combines data from a view into a table in another database on the same server as the SP.
The view refers to the linked OtherServer server. The database, a link to a linked server, is discarded and recreated at night.
So far I have tried these things:
1) Drop and re-create the view before starting MERGE.
2) Defining an SP containing MERGE WITH RECOMPILE .
3) Wrapping the MERGE operator in EXEC() , so it will not be compiled in advance.
4) Setting Bypass Prepare to true at the appropriate step in SSIS.
Edit
SQL Server 2008 is running on the server with the stored procedure. The linked server is 2008 R2.
source share