Wednesday, July 6, 2011

Linked server from SQL Server 2005/2008 to SQL Server 2000

I wanted to create a linked server from SQL Server 2005 to SQL Server 2000 and got the following error when I tried to query the remote server.

OLE DB provider "SQLNCLI10" for linked server "XXXXXX" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI10" for linked server "XXXXXX". The provider supports the interface, but returns a failure code when it is used.

So after some initial research found that there is a Microsoft support page for this error but requires SP3 or higher on the 2000 instance and also requires us to run a particular SQL file called 'instcat.sql in the INSTALL directory for MSSQL. But such a change would require backups of the master database. In case something went wrong.

Ref : http://connect.microsoft.com/SQLServer/feedback/details/465959/unable-to-query-linked-sql-server-2000

So I found this small workaround with less hassles.
Just create the following Stored Procedure and GRANT EXECUTE to the Public.

CREATE PROCEDURE sp_tables_info_rowset_64

@table_name SYSNAME,
@table_schema SYSNAME = NULL,
@table_type nvarchar(255) = NULL
AS

DECLARE @Result INT SET @Result = 0
EXEC @Result = sp_tables_info_rowset @table_name, @table_schema, @table_type
GO


Hope this helps........

No comments:

Post a Comment