Applies ToMicrosoft SQL Server 2005 Service Pack 3 Microsoft SQL Server 2005 Service Pack 4 SQL Server 2008 Service Pack 2 Microsoft SQL Server 2005 SQL Server 2008 SQL Server 2008 R2

Microsoft distributes Microsoft SQL Server 2005, Microsoft SQL Server 2008 and Microsoft SQL Server 2008 R2 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005, Microsoft SQL Server 2008 and SQL Server 2008 R2 fix release.The fix that is described in this article is available for the following versions of SQL Server:

  • Microsoft SQL Server 2005 Service Pack 3 (SP3)

  • Microsoft SQL Server 2005 Service Pack 4 (SP4)

  • Microsoft SQL Server 2008 Service Pack 1 (SP1)

  • Microsoft SQL Server 2008 Service Pack 2 (SP2)

Symptoms

Consider the following scenario:

  • You create a linked server on a computer that is running Microsoft SQL Server 2005, Microsoft SQL Server 2008 or Microsoft SQL Server 2008 R2. The linked server points to an OLE DB data source on a remote server.

  • You create a synonym for a table on the linked server.

  • You create a user-defined function that uses the synonym, or you create a view that uses the synonym. Then, you run a query against the user-defined function or the view.Note When you run the query, an execution plan is cached.

  • You perform an operation on a remote server to update the schema version of the table on the linked server. For example, you rebuild the index of the table on the remote server to update the schema version of the table on the linked server.

  • You run another query against the user-defined function or the view.

In this scenario, you receive an error message that resembles the following:

Server: Msg 7359, Level Level Number, State State Number, Line Line NumberThe OLE DB provider "Provider Name" for linked server "Linked Server Name" reported a change in schema version between compile time ("Compile Time") and run time ("Run Time") for table "Linked Table Name".

Note Provider Name is a placeholder that represents the name of the OLE DB provider. Linked Table Name is a placeholder that represents the name of the table that is on the linked server.

Cause

This issue occurs because the existing execution plan is not cleared correctly. This causes the schema version to change, because the user-defined function or the view is recompiled when the second query is run. Therefore, the error occurs.

Resolution

Cumulative update information

SQL Server 2008 R2 Service Pack 1

The fix for this issue was first released in Cumulative Update 1 for SQL Server 2008 R2 Service Pack 1. For more information about how to obtain this cumulative update package, click the following article number to view the article in the Microsoft Knowledge Base:

2544793 Cumulative Update package 1 for SQL Server 2008 R2 Service Pack 1Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2567616 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 Service Pack 1 was released

SQL Server 2008 R2

The fix for this issue was first released in Cumulative Update 7. For more information about how to obtain this cumulative update package for SQL Server 2008 R2, click the following article number to view the article in the Microsoft Knowledge Base:

2507770 Cumulative Update package 7 for SQL Server 2008 R2 Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

981356 The SQL Server 2008 R2 builds that were released after SQL Server 2008 R2 was released

For SQL Server 2005 SP3

The fix for this issue was first released in Cumulative Update 15. For more information about how to obtain this cumulative update package for SQL Server 2005 SP3, click the following article number to view the article in the Microsoft Knowledge Base:

2507766 Cumulative update package 15 for SQL Server 2005 SP3 Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 SP3 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

960598 The SQL Server 2005 builds that were released after SQL Server 2005 SP3 was released

For SQL Server 2005 SP4

The fix for this issue was first released in Cumulative Update 3. For more information about how to obtain this cumulative update package for SQL Server 2005 SP4, click the following article number to view the article in the Microsoft Knowledge Base:

2507769 Cumulative update package 3 for SQL Server 2005 SP4Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2005 SP4 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

937137 The SQL Server 2005 builds that were released after SQL Server 2005 SP4 was released

For SQL Server 2008 SP1

The fix for this issue was first released in Cumulative Update 13. For more information about how to obtain this cumulative update package for SQL Server 2008 SP1, click the following article number to view the article in the Microsoft Knowledge Base:

2497673 Cumulative update package 13 for SQL Server 2008 SP1 Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 SP1 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

970365 The SQL Server 2008 builds that were released after SQL Server 2008 SP1 was released

For SQL Server 2008 SP2

The fix for this issue was first released in Cumulative Update 3. For more information about how to obtain this cumulative update package for SQL Server 2008 SP2, click the following article number to view the article in the Microsoft Knowledge Base:

2498535 Cumulative update package 3 for SQL Server 2008 SP2Note Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 SP2 fix release. We recommend that you consider applying the most recent fix release that contains this hotfix. For more information, click the following article number to view the article in the Microsoft Knowledge Base:

2402659 The SQL Server 2008 builds that were released after SQL Server 2008 SP2 was released

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

More Information

For more information about how to use Transact-SQL to create a synonym, visit the following Microsoft Developer Network (MSDN) website:

How to use Transact-SQL to create a synonym

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.